jm76
asked on
Capturing the dropdownlist value in a datagrid
Hi,
I have a dropdownlist with 2 buttons (search, update). When the update is clicked, I want to get the value or text in the dropdownlist and add it to a db.
I'm using a normal click event for the update button, b/c of how I want the search/update buttons to display in grid. Can someone help? Maybe provide a snippet of code as an example?
Here is the edit template part of the grid................
<EditItemTemplate>
<TABLE Width="100%" CellPadding="0" CellSpacing="0" Border="0" >
<TR>
<TD>
<asp:DropDownList id="ddlRC" runat="server" Width="115px" >
<asp:ListItem>Jodi MacLeod</asp:ListItem>
<asp:ListItem>Cyrus Hopkins</asp:ListItem>
<asp:ListItem>Andrew Karson</asp:ListItem>
<asp:ListItem>Brit Nicholson</asp:ListItem>
<asp:ListItem>Ishir Bhan</asp:ListItem>
<asp:ListItem>Robert Kraft</asp:ListItem>
</asp:DropDownList>
</TD>
</TR>
<TR>
<TD>
<asp:button
id="bSearch"
runat="Server"
text="Search"/>
<asp:button
id="bUpdate"
runat="Server"
OnClick="bUpdate_Click"/>
</TD>
</TR>
</TABLE>
</EditItemTemplate>
I have a dropdownlist with 2 buttons (search, update). When the update is clicked, I want to get the value or text in the dropdownlist and add it to a db.
I'm using a normal click event for the update button, b/c of how I want the search/update buttons to display in grid. Can someone help? Maybe provide a snippet of code as an example?
Here is the edit template part of the grid................
<EditItemTemplate>
<TABLE Width="100%" CellPadding="0" CellSpacing="0" Border="0" >
<TR>
<TD>
<asp:DropDownList id="ddlRC" runat="server" Width="115px" >
<asp:ListItem>Jodi MacLeod</asp:ListItem>
<asp:ListItem>Cyrus Hopkins</asp:ListItem>
<asp:ListItem>Andrew Karson</asp:ListItem>
<asp:ListItem>Brit Nicholson</asp:ListItem>
<asp:ListItem>Ishir Bhan</asp:ListItem>
<asp:ListItem>Robert Kraft</asp:ListItem>
</asp:DropDownList>
</TD>
</TR>
<TR>
<TD>
<asp:button
id="bSearch"
runat="Server"
text="Search"/>
<asp:button
id="bUpdate"
runat="Server"
OnClick="bUpdate_Click"/>
</TD>
</TR>
</TABLE>
</EditItemTemplate>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.