This is a migrated thread and some comments may be shown as answers.

Cannot fi

1 Answer 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Slava
Top achievements
Rank 1
Slava asked on 28 Oct 2016, 08:07 PM

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>

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 02 Nov 2016, 02:52 PM
Hello Slava,

Here are some steps you can try to address the issue:

Please note that performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:

Declarative DataSource (DataSourceID property)
Programmatic Data Binding (NeedDataSource event, + DetailTableDataBind for hierarchy). You should set the DataSource property ONLY within these event handlers.

In addition, when developing your applications, temporarily disable any AJAX on the page if present (RadAjaxManager, RadAjaxPanel, UpdatePanel, etc.) and enable your script debugger (FireBug or F12) to see whether there are any script or server errors interfering, and make sure that the application works without AJAX.

You can also check the following article:
http://www.telerik.com/help/aspnet-ajax/grid-export-with-ajax-enabled.html


In addition, you can examine with the IgnorPaging ExportingSetting.

Regards,
Eyup
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Grid
Asked by
Slava
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or