I have a following code in my radgrid:
<
CommandItemTemplate
>
<
asp:LinkButton
ID
=
"ExportToPdfButton"
runat
=
"server"
CommandName
=
"ExportToPdf"
CssClass
=
"pdfButton"
></
asp:LinkButton
>
</
CommandItemTemplate
>
The radgrid is ajaxafied with a RadAjaxManager.
Use ItemCreated in I call RegisterPostBackControl so that when I click the PDF button it doesn't use ajax and pops up my PDF.
Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
If TypeOf e.Item Is GridCommandItem Then
Dim btn As LinkButton = e.Item.FindControl("ExportToPdfButton")
If Not btn Is Nothing Then
RadScriptManager.GetCurrent(Page).RegisterPostBackControl(btn)
End If
End If
End Sub
This works fine the first time my page loads. I click the PDF, it opens up... all good.
However, I have a series of combo boxes that are wired in the RadAjaxManager to rebind the grid when changed. When the radgrid gets changed through an ajax postback, and I click the PDF button, it then causes an ajax postback and the commanditem template disappears entirely, and of course.. the PDF is not created.
Any idea how I can make sure the PDF button always does a regular postback?