简体   繁体   English

将参数传递给 RadGrid_NeedDataSource() 事件时出错

[英]Error while passing parameter to RadGrid_NeedDataSource() Event

I am trying to pass DataTable to RadGrid NeedDataSource event function and assign that DataTable to RadGrid but facing below error:我正在尝试将 DataTable 传递给 RadGrid NeedDataSource 事件 function 并将该 DataTable 分配给 RadGrid 但面临以下错误:

Description: An error occurred during the compilation of a resource required to service this request.说明:在编译服务此请求所需的资源期间发生错误。 Please review the following specific error details and modify your source code appropriately.请查看以下特定错误详细信息并适当修改您的源代码。

Compiler Error Message: CS0123: No overload for 'RadGrid2_NeedDataSource' matches delegate 'GridNeedDataSourceEventHandler'编译器错误消息:CS0123:“RadGrid2_NeedDataSource”没有重载与委托“GridNeedDataSourceEventHandler”匹配

Source Error:源错误:

Line 241: <telerik:RadAjaxLoadingPanel runat="server" ID="gridLoadingPanel" Skin="Vista"></telerik:RadAjaxLoadingPanel> Line 242: Line 243: <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid2" runat="server" GridLines="None" Visible="false" AllowSorting="True" AllowPaging="True" PageSize="10" Width="100%" OnNeedDataSource="RadGrid2_NeedDataSource" OnItemDataBound="RadGrid2_ItemDataBound" Skin="Metro" HeaderStyle-Font-Size="8px" PagerStyle-Font-Size="12px" CellSpacing="0"> Line 244: Line 245:第 241 行:<telerik:RadAjaxLoadingPanel runat="server" ID="gridLoadingPanel" Skin="Vista"></telerik:RadAjaxLoadingPanel> 第 242 行:第 243 行:<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid2" runat ="server" GridLines="None" Visible="false" AllowSorting="True" AllowPaging="True" PageSize="10" Width="100%" OnNeedDataSource="RadGrid2_NeedDataSource" OnItemDataBound="RadGrid2_ItemDataBound" Skin="Metro" HeaderStyle-Font-Size="8px" PagerStyle-Font-Size="12px" CellSpacing="0"> 第 244 行: 第 245 行:

My C# code:我的 C# 代码:

DataTable dt=new DataTable();
Radgrid2.NeedDataSource += new GridNeedDataSourceEventHandler((sender, e) => RadGrid2_NeedDataSource(sender, e, dt));

protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e, DataTable t)
{
   RadGrid2.DataSource=t;
}

ASP.NET Code: ASP.NET 代码:

<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid2" runat="server" GridLines="None" Visible="false" AllowSorting="True" AllowPaging="True" PageSize="10" Width="100%" OnNeedDataSource="RadGrid2_NeedDataSource"  OnItemDataBound="RadGrid2_ItemDataBound" Skin="Metro" HeaderStyle-Font-Size="8px" PagerStyle-Font-Size="12px" CellSpacing="0">
                   <ClientSettings ReorderColumnsOnClient="true" AllowColumnsReorder="true" ColumnsReorderMethod="Reorder">
                        <Virtualization EnableVirtualization="true" InitiallyCachedItemsCount="2000" LoadingPanelID="RadAjaxLoadingPanel1" ItemsPerView="100"/>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2"></Scrolling>
                        <Resizing AllowResizeToFit="false" AllowColumnResize="true" />
                    </ClientSettings>
                    <PagerStyle Mode="NumericPages" Height="1em"></PagerStyle>
                    <GroupingSettings CaseSensitive="false" />
                </telerik:RadGrid>

What can be done for this?为此可以做些什么? any suggestion任何建议

Start with reading the vendor documentation on this event.首先阅读有关此事件的供应商文档。 The handier you are trying to attach has the wrong signature, as the error message says.如错误消息所述,您尝试附加的便利工具的签名错误。

Copy the proper one from the docs, remove the dynamic handier addition (you have it in the markup), get the data table inside the handler to give to the grid.从文档中复制正确的一个,删除动态的handier 添加(你在标记中有它),获取处理程序中的数据表以提供给网格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Radgrid将参数传递给NeedDatasource - Radgrid Passing parameter to NeedDatasource RadGrid包装器传递NeedDataSource回调 - RadGrid Wrapper Passing a NeedDataSource callback 在父RadGrid上分页后,嵌套的Telerik RadGrid的NeedDataSource触发 - Nested Telerik RadGrid's NeedDataSource firing after paging on the Parent RadGrid 在Radgrid中以编程方式更改表-NeedDataSource不会在Rebind()上触发 - Programmatically change table in Radgrid - NeedDataSource doesn't fire on Rebind() 在Crystal报表中动态传递参数时出错 - Error while passing parameter dynamically in crystal report 将事件处理程序作为参数传递 - Passing Event handler as parameter 在TELERIK RadGrid中与NeedDataSource进行数据绑定时,如何在列中设置CurrentFilterFunction =“包含” ShowFilterIcon =“ false” - How to set CurrentFilterFunction=“Contains” ShowFilterIcon=“false” in columns when databinding with NeedDataSource in TELERIK RadGrid 将xml路径传递给位图时出现无效的参数错误 - Invalid parameter error while passing xml path to bitmap 将动作委托作为参数传递给构造函数时出现参数错误 - Argument error while passing Action delegate as parameter to constructor 手动执行更新时在RadGrid控件中得到错误? - getting error in RadGrid Control while manually doing update?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM