<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Javascript Radiobutton list selection</title> <script type="text/javascript"> function chk() { var radval = document.getElementById('rad1'); var radlist = radval.getElementsByTagName('input'); if(document.getElementById("DropDownList1").value=="apple") { radlist.item(0).checked=true; } else { radlist.item(1).checked=true; } } </script></head><body> <form id="form1" runat="server"> <div> <asp:RadioButtonList ID="rad1" runat="server"> <asp:ListItem Value="1">Yes</asp:ListItem> <asp:ListItem Value="2">No</asp:ListItem> </asp:RadioButtonList> <br /> <asp:DropDownList ID="DropDownList1" runat="server" onchange='chk();'> <asp:ListItem>apple</asp:ListItem> <asp:ListItem>grapes</asp:ListItem> <asp:ListItem>orange</asp:ListItem> </asp:DropDownList> </div> </form></body></html>
using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Globalization;public partial class _Default : System.Web.UI.Page { protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedItem.Text == "A") { Radio1.Checked = true; Radio2.Checked = true; Radio3.Checked = true; } else { Radio1.Checked = false; Radio2.Checked = false; Radio3.Checked = false; } }}<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> </head><body> <form id="form1" runat="server"> <input id="Radio1" runat="server" name="a" type="radio" /> <input id="Radio2" runat="server" name="a" type="radio" /> <input id="Radio3" runat="server" name="a" type="radio" /> <asp:DropDownList ID="DropDownList1" AutoPostBack="true" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>a</asp:ListItem> <asp:ListItem>b</asp:ListItem> </asp:DropDownList> </form></body></html>
Thanks & RegardsG.RenganathanNothing is mine ,Everything is yours!!!