Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.1
|
BOOK: Beginning ASP.NET 1.1
This is the forum to discuss the Wrox book Beginning ASP.NET 1.1 with Visual C#.NET 2003 by Chris Ullman, John Kauffman, Chris Hart, Dave Sussman, Daniel Maharry; ISBN: 9780764557088
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 11th, 2005, 04:40 AM
Authorized User
 
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
Send a message via Yahoo to whiterainbow
Default How can we assign values to HTMLInputFile Control?

Hi,

I am having a HTMLInputFile in my form. Actually it is the form to edit the details from the database. When I am assigning the value retrieved from the database (filename) to the file control it is not assigning the value to it.

If anybody knows how to assign the value to the file control plz help me.

Whiterainbow

SK
__________________
Thanks in advance.

Regards,

Senthil Kumar M.
 
Old May 11th, 2005, 04:52 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

How do you assign the value?? can you send the code?? do you want to assign from the code behind??

Regards
Ganesh
 
Old May 11th, 2005, 04:58 AM
Authorized User
 
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
Send a message via Yahoo to whiterainbow
Default

No. I am not using Code Behind but I am using VBScript.Net. When the page is loaded, I tried to assign the value to the control by using the property value [filebox.value=Rdr.Item("filenm")] and even I tried this using

<input type="file" value="<%=filen%>"....., where the filen is the public variable that gets the filename at the time of page load.

But both are not working.

SK
 
Old May 11th, 2005, 05:08 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

You should give runat="server" for the HTML Input control to access it in the code. Only then it is accessible from the VB.Net code.

Regards
Ganesh
 
Old May 11th, 2005, 05:31 AM
Authorized User
 
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
Send a message via Yahoo to whiterainbow
Default

I know the silly point and it's already assigned to that control and the control is now running from the server

<input id="filenm" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid" type="file" name="Jobspec" runat="server"/>

now tell me how you will assign the value to this control.



SK
 
Old May 11th, 2005, 05:32 AM
Authorized User
 
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
Send a message via Yahoo to whiterainbow
Default

I know the silly point and it's already assigned to that control and the control is now running from the server

<input id="filenm" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid" type="file" name="filenm" runat="server"/>

now tell me how you will assign the value to this control.



SK
 
Old May 11th, 2005, 07:18 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

what do you mean by assigning the value?? You can read the "PostedFile" property to get the file which the user has selected or the "Value" property to get its path.

Regards
Ganesh
 
Old May 11th, 2005, 07:37 AM
Authorized User
 
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
Send a message via Yahoo to whiterainbow
Default

Now I explain in detail to you in elaborat manner:

I am retrieving the data from database (access). In my database I am having a field to store the filename which i am uploading to the server and it is posted to the server. Now I want to edit the datas in my database and retrieved all the data to the DataReader and displayed the values in the concerned boxes.

In this scenario, I am having a file upload box (it is a HTMLInputFile with syntax <input type="file" runat="server" id="" ...blablabla>.

Now I want to display the name of the file in the box because when I am retrieving the data in that box. I am asking how it can be done?

SK
 
Old May 11th, 2005, 11:24 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Normally we do not show the saved file name in the FileInput box. It just has the details of the file uploaded from the client. You can show the name of the already uploaded file sepeartely with an option to view the contents. You may use an anchor or a Hyperlink for this purpose. Alternatevely to upload another file, you can keep another file control which inturn replaces the original one.

The HTMLInputFile Stores not only just the file name but also many other things related to this file. It is not just a textbox and a button. Using this you can access the properties of the client side file which is being uploaded.

Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
assign numerical values to text ptrussell2009 Excel VBA 9 October 8th, 2017 04:38 AM
Pull data values & assign them to a text control cesemj ASP.NET 2.0 Basics 0 March 12th, 2008 06:54 AM
HTMLInputFile control geeta HTML Code Clinic 44 January 2nd, 2008 03:29 AM
Use VBA to assign cell values eric_winters Excel VBA 2 September 3rd, 2004 02:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.