hi melvik,
thanks...:)
but errr...i don't really understand the code
Currently I can display the contents of the file to another textbox using my following code :
Dim srReadfile As StreamReader
srReadfile = New StreamReader(txtFilename.Text)
txtTextBox1.Text = srReadfile.ReadToEnd()
srReadfile.Close()
Right now I have these 5 controls on my webpage :
<asp:textbox id="txtFilename" runat="server"></asp:textbox>
<asp:textbox id="txtContents" runat="server"></asp:textbox>
<INPUT id="fileUpload" style="DISPLAY: none" type="file" onchange="txtFilename.value = this.value;">
<input id="btnBrowse" onclick="fileUpload.click()" type="button" value="Browse" name="btnBrowse" runat="server">
<asp:button id="btnViewContent" runat="server" text="View Content"></asp:button>
the file open dialog and filename path can be displayed on the txtFilename textbox when i click on the btnBrowse button..
and the contents of the file(from the filename path of txtFilename) will be displayed to another textbox (ie. txtContents) when i click on the 2nd button, btnViewContent
but what I hope to achieve is :
I just need to click on 1 button, which is btnBrowse...
and then I will be able to get the file open dialog and choose the file I want..
and after I had chosen the file, the pathname will be displayed at 1 textbox (ie. txtFilename) and at the same time, the contents of the file I had chosen will be displayed at another textbox (ie. txtContents)
sorry for my poor explaination...
and really appreciate it if anyone can help..thanks in advance :)