Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
4.20/5 (2 votes)
See more:
I have a Link button for download a file, which is placed inside a Telerik RadGrid. in the same page i have another one grid and update pannel. for the initial time everything works fine and am able to download the file. but when i perform any other operation other than download in this page then download option is not working.

After some research i had applied the following code, but it wont give the expected result:

VB
Dim lnk As LinkButton = Nothing
lnk = DirectCast(e.Item.FindControl("lnkdwnload"), LinkButton)
If lnk IsNot Nothing Then
   ScriptManager.GetCurrent(Me).RegisterPostBackControl(lnk)
End If


If i run the same without update panel then everything works great. what is actually the problem here? why it is not working?
Posted
Updated 1-Feb-15 20:00pm
v2
Comments
TheKarateKid 2-Feb-15 16:58pm    
Looks like on your page,if you perform any other operation (ASYNC), file download won't work. By looking at the code, I'm assuming that it's inside one of the eventhandle of the grid. What are the scenarios in which your are binding the grid? You need to make sure that Post Back registration is not lost on any other operations

1 solution

Hello,
Below code is work for me.
Try to use below code in aspx page,

<asp:linkbutton runat="server" id="lnkDownload" commandname="DELETE" ondatabinding="lnkDownload_DataBinding" xmlns:asp="#unknown"></asp:linkbutton>


and use below code in aspx.vb

VB
Protected Sub lnkDownload_DataBinding(sender As Object, e As EventArgs)
    Dim lnkDownload As LinkButton = DirectCast(sender, LinkButton)
    ToolkitScriptManager1.RegisterPostBackControl(lnkDownload)
End Sub
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900