This should be simple -
I have a gridview on my web page with a dropdown that is bound to an ObjectDataSource. The ObjectDataSource has a SelectMethod with a TypeName that points to a DAL. The function inside the DAL is asking for a parameter to pass to Access to perform the query. I used asp:formParameter to specify what control to pass to the adapter to use as a parameter but it's not working. No error, nothing - the dropdown just doesn't get populated unless I give my formParameter a DefaultValue.
My code looks like this:
<aspropDownList runat="server" ID="drpTask" DataSourceID="dsDrpTask" DataValueField="Pkey" DataTextField="TaskName" AppendDataItems="true"></asp:dropDownlist>
After the gridview:
<asp:ObjectDataSource ID="DsDrpTask" runat="server" SelectMethod="GetTaskNameByPosition" TypeName="TaskAdapter">
<selectParameters>
<asp:FormParameter FormField="drpPosition" Name="intPkey" Type="Int32" />
</selectparameters>
</asp:ObjectDataSource>
I am not sure what's going on - I have tried several variations of this and it's the only one that has come close to actually working. I did a response.write on the drpPosition.selectedvalue and it's coming back with a value.
The drpPosition is being populated in the code behind on the Page_Load event.
I have a gridview on my web page with a dropdown that is bound to an ObjectDataSource. The ObjectDataSource has a SelectMethod with a TypeName that points to a DAL. The function inside the DAL is asking for a parameter to pass to Access to perform the query. I used asp:formParameter to specify what control to pass to the adapter to use as a parameter but it's not working. No error, nothing - the dropdown just doesn't get populated unless I give my formParameter a DefaultValue.
My code looks like this:
<aspropDownList runat="server" ID="drpTask" DataSourceID="dsDrpTask" DataValueField="Pkey" DataTextField="TaskName" AppendDataItems="true"></asp:dropDownlist>
After the gridview:
<asp:ObjectDataSource ID="DsDrpTask" runat="server" SelectMethod="GetTaskNameByPosition" TypeName="TaskAdapter">
<selectParameters>
<asp:FormParameter FormField="drpPosition" Name="intPkey" Type="Int32" />
</selectparameters>
</asp:ObjectDataSource>
I am not sure what's going on - I have tried several variations of this and it's the only one that has come close to actually working. I did a response.write on the drpPosition.selectedvalue and it's coming back with a value.
The drpPosition is being populated in the code behind on the Page_Load event.