Click here to Skip to main content
15,905,776 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have radio button list in Datalist Control which display an selected Mobile from database. now i want to select only one Radio button and its works fine. but its only return true value when i select 1st radio button. when i select any other mobile its always return False..

This is my Aspx page code :

XML
<td align="left">
                                <asp:RadioButton ID="optSkinIsSelect" runat="server" />
                                <strong><span><%#DataBinder.Eval(Container.DataItem, "Name")%></span></strong>
                            </td>


I check this condition in my .CS file like this :

C#
foreach (DataListItem item in DataList1.Items)
{
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                {
                    RadioButton optSkinIsSelect = (RadioButton)item.FindControl("optSkinIsSelect");

                    
                        if (optSkinIsSelect != null)
                        {
                            if (optSkinIsSelect.Checked)
                            {
                                Response.Write(optSkinIsSelect.Checked.ToString());
                            }
                            else
                            {

                            }
                        }
                }
            }



Help me to find which radio button is checked. i know the idea we can check it bu for loop but how can i do that i dont knw....

Thank You....
Posted
Updated 11-Apr-12 20:47pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900