收到此错误消息,我无法弄清楚原因。这是我的代码:
<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
答案 0 :(得分:0)
在研究了这个问题/试错之后,解决方案是将Name =“searchParam”添加到表单参数控件中。