FileUpload control postback

Posted by Sravanthi.seeta under ASP.NET on 11/10/2010 | Points: 10 | Views : 15552 | Status : [Member] | Replies : 7
I am working on a ASP.NET app and i have a need to post back to the server after a file is chosen in a FileUpload control without having to have the user explicitly click a 'submit' button. Is this possible? and if so, how?




Responses

Posted by: Vuyiswamb on: 11/10/2010 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Yes its possible , but why do you want to do that ? Here is how you can do it

http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx
http://www.dotnetspider.com/resources/1521-How-call-Postback-from-Javascript.aspx
or you can get the button name in javascript and attach the click event

Thank you for posting at Dotnetfunda
[Administrator]

Sravanthi.seeta, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sravanthi.seeta on: 11/10/2010 [Member] Starter | Points: 25

Up
0
Down
i had uploaded a file using the file upload control and i displayed in the label.When am trying to upload another file the previous text of label in visible mode.. i dont want to show that

Sravanthi.seeta, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: T.saravanan on: 11/10/2010 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,

When will call the button event before you can hide (or) empty the label control.

Try the following code in your Java script

For Hide  before button event

document.getElementById("labelId").style.display='none';

For Show after button event
document.getElementById("labelId").style.display='block';


Cheers :)



Thanks,
T.Saravanan

Sravanthi.seeta, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 11/10/2010 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Why dont you clear it when the Upload is done ?

Thank you for posting at Dotnetfunda
[Administrator]

Sravanthi.seeta, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: SheoNarayan on: 11/10/2010 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Thank you everybody for trying to help Sravanthi ! I am not sure if Sravanthi solved her problem, if not I have just now posted an article detailing your solution. Here is the solution http://www.dotnetfunda.com/articles/article1062-uploading-file-to-the-server-without-clicking-a-button-.aspx

Let me know if you are facing any problem.

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Sravanthi.seeta, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gokul on: 12/8/2010 [Member] Starter | Points: 25

Up
0
Down
in the fileupload leave event you can write the coding.

the fileupload has to be checked whwteher it has any file in it. If it finds any file in it, then you can write the coding for the data to save in DB directly without clicking the sublit button. Try it.


CHeers
Gokul.N

Thanks and Regards,
GokulNath Nithy.

Sravanthi.seeta, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vinay13mar on: 10/14/2012 [Member] Starter | Points: 25

Up
0
Down

Login to post response