开发者

'ObjectDataSource1' could not find a non-generic method 'getCOMDLs' that has parameters:

开发者 https://www.devze.com 2023-01-17 15:19 出处:网络
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=\"btnSear

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 Data开发者_Python百科Field="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


After researching this issue/trial and error, the solution was adding Name="searchParam" to the form parameter control.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号