My app provides a view of validated items from the uploaded files.
I need to bind a grid/listview after files uploaded but when I do it after the uploadfinished event its too late.
If I do a postback to the existing page I lose the list of files in the upload view.
Suggestions?
Hello Daniel,
Thank you for posting in the community.
What I can suggest for achieving your requirement is to use __doPostBack function to trigger a postback once FileUploading client-side event is fired. The __doPostBack function takes two arguments, eventTarget and eventArgument. The eventTarget contains the ID of the control that causes tha postback and eventArguments contains any additional data associated with the control(some further reference about __doPostBack function could be found at: http://aspalliance.com/articleViewer.aspx?aId=895&pId=-1 ).
In your scenario what could be done is to trigger a postback when FileUploading event is fired. Afterwards in the PageLoad event of the page it could be checked whether the eventArgument from the __doPostBack is the same that is set for the FileUploading event and if so rebind the grid. For example:
client-side: WebUpload1_FileUploading(eventArgs, infoObject) { __doPostBack("up1", "fileUploaded"); } code-behind: protected void Page_Load(object sender, EventArgs e) { if (Request["__EVENTARGUMENT"] == "fileUploaded") { //bind your control here }
client-side:
WebUpload1_FileUploading(eventArgs, infoObject)
{
__doPostBack("up1", "fileUploaded");
}
code-behind:
protected void Page_Load(object sender, EventArgs e)
if (Request["__EVENTARGUMENT"] == "fileUploaded")
//bind your control here
I hope you find this information helpful.
Please do not hesitate to contact me if you have any additional questions regarding this matter.
Thanks for your reply.. I tested something similar but if I do post back at this time on file uploading will I have two threads going? one still processing the file and the postback that needs to wait until the file finishes?
If you need any additional assistance with this case feel free to contact us.
I will keep this case open for another three business days while I am waiting for your response. If at that time you haven't responded, I will close it.
Please note that closed cases may be reopened within thirty days of closure.
Thank you for choosing Infragistics components.
If any questions or concerns arise when you test this scenario don’t hesitate to contact us again.
Thank you for the reply. Sounds good. I will test out later; I have spent too much time learning this right now but next round. Thanks again.
Thank you for posting in our community.
Since the post back function is synchronous it would not be processed on separate thread and the uploading process would be terminated. It’s recommended to call the post back function when the file uploading is already finished. To do so the FileUploaded client-side event could be handled and a post back could be initiated in it to load the controls data that you want to display after the files are uploaded.
Please let me know if you have more questions.