0

Hi all,
I need to change label text dynamically for two operations on webpage in asp.net. First,when file uploading is completed label should show 'upload completed'. After that it will perform validation process and later will show the message 'validation complete'.
I have two methods that will be called one by one on Single Button click. I googled a lot but couldn't find a solution for this type of problem. Can someone please help?

Edited by sarvesh_1: inserted new lines

6
Contributors
5
Replies
24
Views
3 Years
Discussion Span
Last Post by EddyC27
1

You need AJAX. A standard button click will process all server side code and then cause a postback to the page, meaning nothing will update until the process is complete.

0

I dont know what is your validation needs but (if you are using the .net upload file control) this control gives great validation functionality compined with the validation controls for client side validation or programmatically for server side validation. In this case in the button click event listener you can update the label text easily using a select case to distinquish cases.
The label text can be updated like this. Label1.Text = string test or string variable.

0

are you talking about validating the file or something else? you can easily check the file type, size and other things before uploading (.net upload file control).

0

From server side, i dont think it is possible since the page will rerender only after completing both operations. So my suggestion is to go for ajax uploading. Check http://www.uploadify.com/demos/ and do the validation too from client side

Edited by anu.achu.330

0

Use the Update Panel of the Ajax toolkit which will help the display purposes. Juts do not include your File Uploader within the UpdatePanel as FileUploaders lose their data as soon as a post back occurs(security issues or something).

If your label is outside the Update Panel then just set the button as a Trigger.
In the Button click event use something like the following:

FileUpload fup = new FileUpload();
if(fup.HasFile)
{
//Call your class

}

The main point is to not include your FileUploader within the UpdatePanel, as soon as any Postback occurs it will lose its data. If the Button and label are within the same UpdatePanel then you wont need to set any triggers

For more visit:
http://msdn.microsoft.com/en-us/library/vstudio/bb399001(v=vs.100).aspx
http://ajax.net-tutorials.com/controls/updatepanel-control/

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.