Redirect after refreshing update panel
Posted
by teebot.be
on Stack Overflow
See other posts from Stack Overflow
or by teebot.be
Published on 2009-07-17T06:44:16Z
Indexed on
2010/05/30
12:02 UTC
Read the original article
Hit count: 162
Hello,
Do you think it's possible to refresh an update panel and immediately after redirecting the response (for instance a download) ?
I tried this:
an invisible button -> as an asyncpostbacktrigger
a download button -> when it is clicked the onclientclick clicks the invisible button
- the click event on the invisible button refreshes the update panel
- then the download button click event launches the download (normal postback which launches the download)
However for some reason when the invisible button is clicked by the download button client script, it doesn't refresh the update panel..
Do you have an idea why it doesn't work? Or do you have other and cleaner techniques?
Here's how the elements are declared:
<asp:Button runat="server" ID="ButtonInvisible" Text="" Click="RefreshDisplay" />
<asp:Button runat="server" ID="ButtonDownload" Text="Download" OnClientClick="clickInvisible(this.id)" Click="Download" /><Triggers>
<asp:AsyncPostBackTrigger ControlID="ButtonInvisible" /></Triggers>
//the javascript
<script type="text/javascript" language="javascript">
function clickInvisible(idButton) {
document.getElementById('ButtonInvisible').click();
}</script>
'
//the methods
Download(object source, EventArgs e){Response.Redirect("test.txt")}
RefreshDisplay(object source, EventArgs e){ ButtonCancel.Enabled = false;}
© Stack Overflow or respective owner