I have a page with button for download a file, after I press that , I want a user control to be refreshed .that can be done with a function I wrote in UC.
So: How Can I Call a js Function in User_Control from Parent server-side(after user press Download_button to download a file)
I used this code, but it doesn't work?
Page.ClientScript.RegisterStartupScript(this.GetType(),"UpdateReportList", "UpdateReportList();", true);
Note: UpdateReportList() is js function in my user control .
HttpContext.Current.Response.WriteFile(sFilePath)writes the attachment to the entire response body and no other markup or script get appended throughPage.ClientScript.RegisterStartupScript(). That's the reason you don't see of triggeringUpdateReportList()in the browser.The approach to be changed, there are couple of other options to achieve this functionality.
Set a cookie instead of
Page.ClientScript.RegisterStartupScript()as it's part of response header. Start a javascript timer usingsetInterval(), request to download, read the cookie, stop the timer, clear the cookie and callUpdateReportList().Move the entire code to asp.net generic handler (.ashx) and repeat the same steps as described above.
You can think of some other options based on your requirement.