Pass Parameter to LinqDataSource "OnSelecting" for Stored Procedure
I'm building a semi-elaborate RadGrid where within my NestedViewTemplate I want to have a LinqDataSource that uses a Stored Procedure to get data from the database.
Here's what I have so far
<asp:HiddenField runat="server" ID="HiddenID" Value='<%#DataBinder.Eval(Container.DataItem, "ID")%>' />
<asp:LinqDataSource ID="LinqDataSource1" runat="server" OnSelecting="LinqDataSource_Selecting">
<WhereParameters>
<asp:ControlParameter ControlID="HiddenID" PropertyName="ID" Type="String" Name="ID" />
</WhereParameters>
</asp:LinqDataSource>
any my Code Behind...
Protected Sub LinqDataSource_Selecting(ByVal sender As Object, ByVal e As LinqDataSourceSelectEventArgs)
Dim hdc As New DAL.HealthMonitorDataContext()
e.Result = hdc.bt_HealthMonitor_GetByID(Integer.Parse(e.WhereParameters("ID")))
End Sub
but unfortunately hdc.bt_HealthMonitor_开发者_Python百科GetByID(Integer.Parse(e.WhereParameters("ID")))
isn't playing nice...
Exception Details: System.FormatException: Input string was not in a correct format.
The "PropertyName" was incorrect in the WhereParameters.
<asp:ControlParameter ControlID="HiddenID"
PropertyName="Value"
Type="String"
Name="ID" />
精彩评论