Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the html radiobutton.have tradgrid on the page with html redio button. Now i need value of rediobutton at server side.How can i write the button selected event in cs file. Is there any way i could do that one
Posted
Updated 31-Aug-12 22:17pm
v2

Hi ,
Check this
XML
<input id="Radio1" type="radio" runat="server" name="rid"  />
  <input id="Radio2" type="radio" runat="server" name ="rid2"/>
  <asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />


C#
protected void Button2_Click(object sender, EventArgs e)
{
    if (Radio1.Checked == true )
    {
        Response.Write("<script>alert('Checked')</script>");

    }
    else if(Radio2.Checked == true)
    {
        Response.Write("<script>alert('Checked 2')</script>");

    }
    else
    {
        Response.Write("<script>alert('not Checked ')</script>");
    }
}

Best Regards
M.Mitwalli
 
Share this answer
 
Hi,

When you write runat="server" attribute for your html radio button it will be accessible on the code behind.

Thanks
-Amit Gajjar
 
Share this answer
 

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