|
Hello,
I posted a message here before and I dont now if this is the right forum for me byt the question that I need help with is this.
I have this code. This code shown all the image file I have but I need to rean in the textfile to.
<%
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(Server.MapPath("/test/"))
Set fc = f.Files
For Each f1 in fc
if right(lcase(f1.name),4) = ".gif" then Response.Write(" ")
Next
%>
And I want to read in a textfile with the same namn but is not a *.gif its a *.txt file. This is the response I get.
foreach (string s in System.IO.Directory.GetFiles(@"c:\dir", "*.gif"))
{
string txtPath = s.Substring(0, s.Length - 3) + "txt";
System.IO.TextReader tr = new System.IO.StreamReader(txtPath);
string text = tr.ReadToEnd();
tr.Close();
}
Now how can I make this work. I need to show the image and then the text after the image. There can be many image and text files so I dont now how I should do it. Is there a king on asp that can help med with this?
|
|
|
|
|
Hi there,
Looks like you want to convert the .net code of reading text files into vb script and put it inside the For Each statement of the classic ASP code. The documentation of the FileSystemObject may give you some hints:
FileSystemObject Sample Code [^]
Also, the Web Development[^] is the right room for the classic ASP questions, and here is for the ASP.NET.
|
|
|
|
|
Hello,
I am new to XML Web Services in .NET. I am looking for some of the following few FREE web services which I can use on my website.
Please suggest me some websites where I can get some of these free webservices.
(1)Sending SMS to anywhere in India
(2)Collecting weather information for Indian Cities and Towns
(3)Checking if an e-mail id is valid or not
(4)Any othere utility webservices
Thanks
-Sudhakar
|
|
|
|
|
|
|
Pals, i have two buttons at one form, one to logout and the other one to submit the form, i fill the form like anyone, the problem is when i press the enter button the logout button event start to working, and i want to start to run submit button, its basic but i didnt fix it.
gracias
keep Learning and you never will be out of date...
|
|
|
|
|
Hi,
It looks like you have problem with naming... If you hit Enter Button....Logout Button should never perform any action and vice versa.... Please check the event handling..
hope it works.
Happy Programming.
Sanjeev
|
|
|
|
|
You might want to check if the submit has the focus when you hit the Enter. Anyway, in the ASP.NET 2.0, you can have a look at the HtmlForm.DefaultButton Property[^]
|
|
|
|
|
To access formview editing element in a class function, I can use the following code:
HttpContext.Current.Request.Form("fvwName$elmName")
How can I access gridview editing row element value in a class function?
|
|
|
|
|
+ Get reference to the Page instance by casting the HttpContext.Current.Handler property to the Page .
+ Get reference to the GridView control using the Page instance and the FindControl method.
+ Get reference to the editable row using the properties of the GridView instance that you have in the previous step.
|
|
|
|
|
Could you please post some code sample?
|
|
|
|
|
Below is the sample code for getting the edit row, and once you have the reference you can easily access the edit values from the cells of the row:
public GridViewRow GetEditRow()
{
Page page = HttpContext.Current.Handler as Page;
GridView gridView = page.FindControl("GridView1") as GridView;
GridViewRow editRow = gridView.Rows[gridView.EditIndex];
return editRow;
}
|
|
|
|
|
When I try your code, I got the following error on line GridViewRow editRow = gridView.Rows[gridView.EditIndex];
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
|
|
|
|
|
That's because I'm using the Edit built-in button in the GridView control so that when I hit the Edit button, the control's mode is changed to the Edit mode and the EditIndex property is set internally. And when the Update button is clicked, I can access the edit row in a seperate class with the above code. I'm not sure when you want to run that code, but if you use your own button, you can raise the Edit command like the built-in button by setting the CommandName as Edit . You might also try to have a look at the EditIndex value at runtime to diagnose your problem. The basic idea is that you need a way to determine the row that is being edited and the index of the row comes to mind as an option.
|
|
|
|
|
I have made an ASP.NET 2 website. I compiled it using release setting both in web.config file and in visual studio. I placed the site on the host. My problem is "when an error occures in any page It does not shows detail information about error". It displays the below message.
Even when I set this tag <customErrors mode="Off"/> it again displays that message .Can someone help me please ? How can I fix it ?
---------------------------------------------------------------
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
--------------------------------------------------------------
|
|
|
|
|
Are you sure your host supports ASPNET2?
|
|
|
|
|
How to make DropDownList in property window for usercontrol ? I would like to chose values form DropDownList in property window for my control but i dont have any idea how to do it, please help
StonePit
|
|
|
|
|
Ok answer is enum
StonePit
|
|
|
|
|
Quick question..I am having tough time trying to access a button (from JavaScript function) that is binded to an item template of a datalist control. This datalist is part of a user control (.ascx) and the user control is dragged and dropped on the webpartzone control on the web page. Any suggestions would be appreciated.
I am trying to access this button from JavaScript to do some client side validations.
Thanks.
|
|
|
|
|
I m using detailsview to update a record.
It contains 2 dropdown lists. one is populated from seperate table. depending on selected value of first drop down list i need to populate second one. selected values of these dropdown lists are updated in table. drop down lists pulls data from two seperate tables. and the values are updated in third one.
Can any body help how this should be done....
Thanks
|
|
|
|
|
Hi,
here i have described it for two dropdown list.
Like wise try for 3 drop downlist.
create two dropdownlist as "ddlParent" and "ddlChild".
Populate the "ddlParent" using
if(!Page.IsPostBack)
{
SqlDataAdapter ad = new SqlDataAdapter("SELECT PersonID FROM Person",myConnection);
DataSet ds = new DataSet();
ad.Fill(ds,"Person");
ddlParent.DataSource = ds;
ddlParent.DataTextField = "PersonID";
ddlParent.DataValueField = "PersonID";
ddlParent.DataBind();
}
Now in the selectedIndexChanged event of the "ddlParent" you will implement the code that will fill the "ddlChild".
private void ddlParent_SelectedIndexChanged(object sender, System.EventArgs e)
{
int personID = Convert.ToInt32(ddlParent.SelectedItem.Value);
string query = "SELECT PhoneNumber,PhoneID FROM Phone WHERE PersonID = "+personID;
SqlDataAdapter ad = new SqlDataAdapter(query,myConnection);
DataSet ds = new DataSet();
ad.Fill(ds,"Phone");
ddlChild.DataSource = ds;
ddlChild.DataTextField = "PhoneNumber";
ddlChild.DataValueField = "PhoneID";
ddlChild.DataBind();
}
Hope it will give an idea.
Happy Coding,
With Regards
Satips
|
|
|
|
|
hi,
i need project ideas in asp.net. i need challenging asp.net project ideas. please help.
love,
lavanya.
|
|
|
|
|
That's a bit vague. Why do you need a project idea? For what purpose is the project? If it is for your own education, what things are you interested in?
|
|
|
|
|
How about a Mars Rover control panel in asp.net
That should be challenging.
"a fool will not learn from a wise man, but a wise man will learn from a fool"
"It is hard to fail, but it is worse never to have tried to succeed." - Theodore Roosevelt
"Success is going from failure to failure without losing your enthusiasm." - Winston Churchill
My Website || My Blog
|
|
|
|
|
hi lavanya
you refer www.dotnetspider.com..
u get ideas in project
thanx
|
|
|
|