Hi all, I am needing to put a dropdown in the edit portion of my gridview that is controlled by another field in the gridview.
ex:
custnum dropdown 1
dropdown 1 is a list of branches within that custnum, I want them to be able to select a branch for that custnum, but not sure how to do that within the gridview. This is what I have so far and I think it is obvious what I am trying to do, just unsuccessfully.. I belive my control paramater needs to be something different...
<asp:TemplateField HeaderText="Branch 1" SortExpression="Branch1">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSourc
e1"
DataTextField="Rh_BranchID
" DataValueField="Rh_BranchI
D" SelectedValue='<%# Bind("Branch1") %>'>
</asp:DropDownList><asp:Sq
lDataSourc
e ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SQLRPTHC
ISDataConn
ectionStri
ng %>"
SelectCommand="SELECT DISTINCT [Rh_BranchID] FROM [ARHeader] WHERE ([Rh_CustomerNoWork] = @Rh_CustomerNoWork) ORDER BY [Rh_BranchID]">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="Rh_CustomerNoWork" PropertyName="SelectedValu
e"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Branch1") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Thanks,
Randy
Start Free Trial