<%@ Page Title="" Language="C#" MasterPageFile="~/UserArea/MainMaster.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <p> <br /> <asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True" Checked="True" GroupName="a" oncheckedchanged="RadioButton1_CheckedChanged" /> <asp:RadioButton ID="RadioButton2" runat="server" AutoPostBack="True" GroupName="a" oncheckedchanged="RadioButton2_CheckedChanged" /> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> </p> <p> </p> <p> </p> </asp:Content>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // } protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { //code block } protected void RadioButton2_CheckedChanged(object sender, EventArgs e) { //code block } protected void Button1_Click(object sender, EventArgs e) { RadioButton2.Checked = true; } }
protected void Button1_Click(object sender, EventArgs e) { RadioButton2.Checked = true; RadioButton1.Checked = false; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)