How to get value of radio in datalist?

Anh Nguyen

I have a data list like this :

<asp:DataList ID="DataList1" runat="server" BackColor="White" BorderColor="#CC9966"
        BorderStyle="None" BorderWidth="1px" CellPadding="4" GridLines="Both" RepeatColumns="3"
        onitemdatabound="DataList1_ItemDataBound">
        <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
        <ItemStyle BackColor="White" ForeColor="#330099" />
        <ItemTemplate>
            <table>
                <tr>
                    <td style="width:10px">
                        <asp:RadioButton ID="rd_CS" runat="server" GroupName="Casi" 
                         oncheckedchanged="rd_CS_CheckedChanged" Text='<%# Eval("Key")%>'></asp:RadioButton>
                    </td>
                    <td>
                        <asp:Image ID="Img_Nhacsi" runat="server" ImageUrl='<%#Eval("Hinhanh")%>' Width="75px"
                            Height="75px" BorderColor="#66FF33" />
                    </td>
                    <td>
                        <asp:Label ID="lbl_Ten" runat="server" Text='<%#Eval("Name")%>'></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="lbl_Ngaysinh" runat="server" Text='<%#Eval("Birthdate")%>'></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="Label2" runat="server" Text='<%#Eval("Country")%>'></asp:Label>
                    </td>
                </tr>
            </table>
        </ItemTemplate>
        <SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
    </asp:DataList>

I got a button submit in page. How to get the text of checked radio button when i click submit button ? Any help would be great.

afzalulh

Probably you need something like this (Credit goes to Guffa):

string myRadioText = String.Empty;

foreach (DataListItem item in DataList1.Items)    
{    
    RadioButton rd_CS = (RadioButton)item.FindControl("rd_CS");

    if(rd_CS != null && rd_CS.Checked)
    {
        myRadioText = rd_CS.Text;
    }    
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How get value of selected radio button in datalist

From Dev

How to get the value of data selected in datalist in Javascript?

From Dev

how I can get the value from datalist

From Dev

How do I get the value of a datalist option and assign it to another element?

From Dev

How to get value of checked radio?

From Dev

how to add multiple value to datalist

From Java

How to get value of selected radio button?

From Dev

How do I get the value of the radio button?

From Dev

How to get value of selected radio button in angularjs

From Dev

How To get Selected Radio Button Value in Mvc

From Dev

How to get the value of the selected radio button?

From Dev

How to get radio button value in SweetAlert with AngularJS

From Dev

how to get checked radio button value in javascript

From Dev

How to get the value of a radio button in a table - PHP

From Dev

how get radio button value in javascript

From Dev

How to get the value of radio button in ColdFusion?

From Dev

How to get the value of a group of Radio Buttons in ReactJS

From Dev

how to get all radio button value by name

From Dev

Get current value from datalist onhover

From Dev

How to bind the control in Datalist with new value?

From Dev

How to get the value of radio buttons so that the value can be manipulated

From Dev

how to get both checkbox value and radio value in angularjs

From Dev

Get radio button value

From Dev

How to get dynamic id using HiddenField in Datalist

From Dev

How to get largest number from Firebase datalist

From Dev

How to Get Text Of Selcted index in datalist tag

From Dev

how to set and get the value of gender radio button in android studio?

From Dev

How to get the NAME and value of a radio button when DYNAMICALLY selected - in jQuery?

From Dev

How to dynamically get checked value from multiple radio groups?

Related Related

  1. 1

    How get value of selected radio button in datalist

  2. 2

    How to get the value of data selected in datalist in Javascript?

  3. 3

    how I can get the value from datalist

  4. 4

    How do I get the value of a datalist option and assign it to another element?

  5. 5

    How to get value of checked radio?

  6. 6

    how to add multiple value to datalist

  7. 7

    How to get value of selected radio button?

  8. 8

    How do I get the value of the radio button?

  9. 9

    How to get value of selected radio button in angularjs

  10. 10

    How To get Selected Radio Button Value in Mvc

  11. 11

    How to get the value of the selected radio button?

  12. 12

    How to get radio button value in SweetAlert with AngularJS

  13. 13

    how to get checked radio button value in javascript

  14. 14

    How to get the value of a radio button in a table - PHP

  15. 15

    how get radio button value in javascript

  16. 16

    How to get the value of radio button in ColdFusion?

  17. 17

    How to get the value of a group of Radio Buttons in ReactJS

  18. 18

    how to get all radio button value by name

  19. 19

    Get current value from datalist onhover

  20. 20

    How to bind the control in Datalist with new value?

  21. 21

    How to get the value of radio buttons so that the value can be manipulated

  22. 22

    how to get both checkbox value and radio value in angularjs

  23. 23

    Get radio button value

  24. 24

    How to get dynamic id using HiddenField in Datalist

  25. 25

    How to get largest number from Firebase datalist

  26. 26

    How to Get Text Of Selcted index in datalist tag

  27. 27

    how to set and get the value of gender radio button in android studio?

  28. 28

    How to get the NAME and value of a radio button when DYNAMICALLY selected - in jQuery?

  29. 29

    How to dynamically get checked value from multiple radio groups?

HotTag

Archive