1
Answer

radiobuttonlist text and values

How to save values into databse and access Text into gridview with radiobuttonlist controls.
 
here my code is
  1. <b>Gender:</b>  
  2. <asp:RadioButtonList ID="RdblGender" runat="server">  
  3. <asp:ListItem Text="Male" Value="M" ></asp:ListItem>  
  4. <asp:ListItem Text="FeMale" Value="F" ></asp:ListItem>  
  5. </asp:RadioButtonList><br /><br />  
  6. <asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />  
  7. <asp:GridView ID="gridview1" runat="server" Width="100%" AutoGenerateColumns="false" DataKeyNames="Id"  
  8. OnRowEditing="gridview1_RowEditing"  
  9. OnRowDeleting="gridview1_RowDeleting"  
  10. OnRowUpdating="gridview1_RowUpdating"  
  11. OnRowCancelingEdit="gridview1_RowCancelingEdit"  
  12. OnRowDataBound="gridview1_RowDataBound">  
  13. <Columns>  
  14. <asp:TemplateField HeaderText="Gender">  
  15. <ItemTemplate>  
  16. <%#Eval("Gender")%>  
  17. </ItemTemplate>  
  18. <EditItemTemplate>  
  19. <asp:RadioButtonList ID="rdblEditGender" runat="server">  
  20. <asp:ListItem Text="Male" Value="Male" ></asp:ListItem>  
  21. <asp:ListItem Text="FeMale" Value="FeMale" ></asp:ListItem>  
  22. </asp:RadioButtonList>  
  23. <asp:Label ID="lblGender" runat="server" Text='<%#Eval("Gender")%>' Visible="false" />  
  24. </EditItemTemplate>  
  25. </asp:TemplateField>  
  26. </Columns>  
  27. </asp:GridView>  
here radiobutton values "M","F" are stored into Databse and access gridview by Text "Male","FeMale", How?

Answers (1)