Redirect after refreshing update panel
- by teebot.be
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;}