Hello,
I have some interesting problem with RadGrid.
My Rad grid has export buttons (CSV, Excel etc).
Clicking them invokes ItemDataBound event handler attached to the RadGrid.
protected
void
rgManagementSummaryReport_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
((e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) && e.Item.DataItem !=
null
)
{
Button btnPreview = (Button)gdi.FindControl(
"btnPreview"
);
}
}
I have following template column. Initially it had RadButton btnSearch instead of Button btnSearch. It appears that FindControl("btnSearch") would only find asp.net built in Button but not RadButton. I looked at Controls collection of Preview column and saw that it only had my HyperLink and some Literal ones. That's why I had to swith to a regular Button. But our ueb site's pages utilize RadControls everywhere so I would like to be able to return RadButton there and make it find.
Btw regular RadGrid databinding works ok and RadButton is found there as always, so it must be something releated to these Export buttons.
Thanks
<
telerik:GridTemplateColumn
UniqueName
=
"Preview"
>
<
ItemTemplate
>
<%-- <
telerik:RadButton
ID
=
"btnPreview"
runat
=
"server"
Visible
=
"false"
Text
=
"Preview"
OnClick
=
"btnPreview_Click"
>
<
Icon
PrimaryIconCssClass
=
"rbConfig"
></
Icon
>
</
telerik:RadButton
> --%>
<
asp:Button
OnClick
=
"btnPreview_Click"
runat
=
"server"
ID
=
"btnPreview"
Text
=
"Preview"
Visible
=
"false"
/>
<
asp:HyperLink
ID
=
"hlReportView"
runat
=
"server"
Visible
=
"false"
Target
=
"_blank"
>View Report</
asp:HyperLink
>
</
ItemTemplate>
</
telerik:GridTemplateColumn
>