Post back clears out the value in Input Control

 Dear All,

 I am using html input control to upload images to database (with browse button). it is running at server. when I click on button to send data to Database, it clears out the file path or browsed file due to postback.

any idea to read the file path before it clears out with click of send button.

Thanks,
 

0
fahimataspnetforums
11/25/2007 2:33:22 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

5 Replies
691 Views

Similar Articles

[PageSpeed] 3

Can you post the code? Do you have EnableViewState="false"?


Cheers
Al
My Blog
MapStats.NET
Please click on 'Mark as Answer' if this post answered your question!
0
albertpascual
11/25/2007 2:40:31 PM

 Are you talking about EnableViewState for Input control, if yes, then before it had no value, then i tried with both False and true, but no help.

code is simple,

 in Click event of Submit button, I am reading the value of file path from Input control (user browse the file from hard disk). but with any post back, the web page clears the value of Input control,

Dim path as string = File1.Value

Where File1 is name of HTML input control. (so i always get the null value in above code) 

 

 

0
fahimataspnetforums
11/25/2007 2:52:33 PM

If my memory does not fail me, I believe the File1 has a boolean property called something like PostedFile when is true you can access the value, but no before, somebody else can confirm that. Let me go and check my code and I'll come back to you


Cheers
Al
My Blog
MapStats.NET
Please click on 'Mark as Answer' if this post answered your question!
0
albertpascual
11/25/2007 3:01:17 PM

I just check, instead of checking the value, check the PostedFile  

if(File1.PostedFile != null)
{
File1.PostedFile; // PostedFile
filePosted.FileName; // Filename

Hope this helps


Cheers
Al
My Blog
MapStats.NET
Please click on 'Mark as Answer' if this post answered your question!
0
albertpascual
11/25/2007 3:04:00 PM

 Thanks for your replies.

 let me rephrase my question. I know how to read the value of path choosen by user in FileUpload or Input control. but when I click on button to upload, the page post back clears it out (in other words, it remove the path of file control). so none of approach will read any thing, because there is no path in control properties.

I am so surprised, how will i ever read the value of path if page postback clears it out. then what is use of those two controls.

I am using the 2005 version.

I see lot of code out there, but I wonder, how other people make use of it, and why i can't.

 
please somebody help.

thanks,
 

0
fahimataspnetforums
11/25/2007 4:44:36 PM
Reply:

Web resources about - Post back clears out the value in Input Control - asp.net.web-forms

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Stamp duty spiralling out of control: Property Council puts pressure on state leaders
... than twice as much from property sales than in 2000, Deloitte report finds. The Property Council says stamp duty has spiralled out of the control, ...

Venezuela's Opposition Wins Control of Legislature - Al Jazeera America
... celebrate the closing of a polling station during legislative elections in Caracas, Venezuela, Dec. 6, 2015. The opposition won control of the ...

Arizona leaders welcome 'Leave No Child Behind' successor, less federal control
azcentral.com Arizona leaders welcome 'Leave No Child Behind' successor, less federal control azcentral.com The Senate gave final approval ...

Google seems more determined than ever to take control of Android
... to ad money. However, Google grabbed the lion’s share of the smartphone market by giving Android away. That means it lost the ability to control ...

Sugr Cube is a Sweet Spotify Speaker with Touch & Motion Control
... goodies, like Spotify Connect, Pandora, and, eventually, Air Play integration. Sugr also had a little bit of fun with volume and track controls ...

NV's Fiore: 'That 5 Year Old Grandson Of Mine Has Total Trigger Control'
It's very likely you've seen Michele Fiore's family Christmas photo by now, it's been all the rage at Idiocracy viewing parties everywhere. If ...

Obama’s Gun Control Measures Won’t Solve Anything
France’s strict background checks and weapons bans didn’t stop the terrorists from getting the AK-47s and explosive belts.

Shocking Facts About U.S. Gun Control
The Second Amendment has been the subject of debate for centuries now, and you might be surprised to find where that still-unsettled dispute ...

Chinese university finds a way to control cars with your brain
While Google and other automakers were developing autonomous cars, a group of Chinese researchers were working on a way to control vehicles with ...

Resources last updated: 12/10/2015 8:15:23 AM