mahesh
.aspx page: <asp:RadioButton ID="radio" runat="server" AutoPostBack="true" Text="Male" OnCheckedChanged="Method" /> <br /> Text: <asp:TextBox ID="txtage" runat="server" /> .aspx.cs: protected void Method(object sender, EventArgs e) { if (radio.Checked) { txtage.Focus(); } }
Awesome Coding !! :)
<script type="text/javascript"> function getCheckedRadio() { var radioButtons = document.getElementsByName('<%=RadioButtonList1.ClientID%>'); if (radioButtons[1].checked) { document.getElementById('<%= TextBox1.ClientID %>').focus(); } else { document.getElementById('<%= TextBox2.ClientID %>').focus(); } } </script>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" onClick="javascript:return getCheckedRadio();"> <asp:ListItem>Yes</asp:ListItem> <asp:ListItem>No</asp:ListItem> </asp:RadioButtonList> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
Login to post response