“对象数据源1”找不到非通用方法“getCOMDLs”;有参数:
收到此错误消息,我无法弄清楚原因。这是我的代码:
<asp:TextBox ID="searchParam" Width="250px" runat="server"></asp:TextBox><asp:button ID="btnSearch" runat="server" Text="Search" />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="getCOMDLs" TypeName="NewEmployee">
<SelectParameters>
<asp:FormParameter FormField="searchParam" Type="String" DefaultValue="" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:GridView ID="dgSearchDLs" runat="server" DataKeyNames="cn" AllowPaging="false" DataSourceID="ObjectDataSource1">
<Columns>
<asp:BoundField DataField="cn" HeaderText="DL Name"/>
<asp:BoundField DataField="managedBy" HeaderText="Managed By"/>
<asp:BoundField DataField="info" HeaderText="Notes"/>
<asp:ButtonField ButtonType="Button" text="Add" HeaderText = "Select DL" CommandName="AddDL" />
</Columns>
</asp:GridView>
NewEmployee 类:
Function getCOMDLs(ByVal searchParam As String) As DataTable
...
End Function
Getting this error message and I am not able to figure out why. Here is my code:
<asp:TextBox ID="searchParam" Width="250px" runat="server"></asp:TextBox><asp:button ID="btnSearch" runat="server" Text="Search" />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="getCOMDLs" TypeName="NewEmployee">
<SelectParameters>
<asp:FormParameter FormField="searchParam" Type="String" DefaultValue="" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:GridView ID="dgSearchDLs" runat="server" DataKeyNames="cn" AllowPaging="false" DataSourceID="ObjectDataSource1">
<Columns>
<asp:BoundField DataField="cn" HeaderText="DL Name"/>
<asp:BoundField DataField="managedBy" HeaderText="Managed By"/>
<asp:BoundField DataField="info" HeaderText="Notes"/>
<asp:ButtonField ButtonType="Button" text="Add" HeaderText = "Select DL" CommandName="AddDL" />
</Columns>
</asp:GridView>
NewEmployee Class:
Function getCOMDLs(ByVal searchParam As String) As DataTable
...
End Function
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
研究此问题/反复试验后,解决方案是将 Name="searchParam" 添加到表单参数控件。
After researching this issue/trial and error, the solution was adding Name="searchParam" to the form parameter control.