DropDown inside gridview

Joined
Feb 25, 2008
Messages
5
Reaction score
0
Now the dropdown displaying the current value from my db but how do i update the selected value so that it save in database.

Code:
# Protected Sub GV_ApproveNomination_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GV_ApproveNomination.RowDataBound  
   
   
     If e.Row.RowType = DataControlRowType.DataRow Then  
         Dim cmbGender As DropDownList = CType(e.Row.FindControl("DdlGender"), DropDownList)  
   
         cmbGender.SelectedValue = GV_ApproveNomination.DataKeys(e.Row.RowIndex).Values(1).ToString()  
         cmbGender.DataBind()  
   
     End If  
 End Sub


Code:
 <asp:TemplateField HeaderText="Gender">  
     <ItemTemplate>  
         <asp:Label ID="lblGender" runat="server" Text='<%# Eval("iGender") %>'></asp:Label>  
     </ItemTemplate>  
   
     <EditItemTemplate>  
       
      <asp:DropDownList ID="DdlGender" runat="server" SelectedValue='<%# Trim(Eval("iGender"))%>'>  
             <asp:ListItem Value="M" Text="Male"></asp:ListItem>  
             <asp:ListItem Value="F" Text="Female"></asp:ListItem>  
     </asp:DropDownList>  
       
           
     </EditItemTemplate>  
 </asp:TemplateField>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,560
Members
45,035
Latest member
HoTaKeDai

Latest Threads

Top