Cannot fi

2 posts, 0 answers
  1. SlavaTT
    SlavaTT avatar
    2 posts
    Member since:
    May 2007

    Posted 28 Oct Link to this post

    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>

  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 02 Nov Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top