📄 defaultcs.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Telerik.WebControls;
using Telerik.QuickStart;
namespace Telerik.CallbackExamplesCSharp.Callback.Examples.Controls.RadioButton
{
/// <summary>
/// Summary description for DefaultCS.
/// </summary>
public class DefaultCS : XhtmlPage
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox tbFirstName;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox tbLastName;
protected Telerik.WebControls.CallbackRadioButton CallbackRadioButton1;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox tbGradDate;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.TextBox tbFieldOfStudy;
protected Telerik.WebControls.CallbackRadioButton CallbackRadioButton2;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.TextBox tbSubjects;
protected System.Web.UI.WebControls.Label Label7;
protected System.Web.UI.WebControls.TextBox tbExperience;
protected System.Web.UI.WebControls.Label Label8;
protected System.Web.UI.WebControls.TextBox tbSchoolName;
protected Telerik.WebControls.CallbackButton CallbackButton1;
protected System.Web.UI.WebControls.Label label11;
protected System.Web.UI.WebControls.Label statusLabel;
protected Telerik.WebControls.LoadingPanel LoadingPanel1;
protected System.Web.UI.HtmlControls.HtmlImage Img1;
protected System.Web.UI.WebControls.Label lbStatus;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.CallbackRadioButton1.CheckedChanged += new System.EventHandler(this.CallbackRadioButton1_CheckedChanged);
this.CallbackRadioButton2.CheckedChanged += new System.EventHandler(this.CallbackRadioButton1_CheckedChanged);
this.CallbackButton1.Click += new System.EventHandler(this.CallbackButton1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
bool updated = false;
private void Update()
{
if (!updated)
{
updated = true;
if (CallbackRadioButton1.Checked)
{
tbGradDate.Enabled = true;
tbFieldOfStudy.Enabled = true;
tbSubjects.Enabled = false;
tbExperience.Enabled = false;
tbGradDate.BackColor = Color.FromName("#ffffe1");
tbFieldOfStudy.BackColor = Color.FromName("#ffffe1");
tbSubjects.BackColor = Color.FromName("#f2f2f2");
tbExperience.BackColor = Color.FromName("#f2f2f2");
}
else
{
tbGradDate.Enabled = false;
tbFieldOfStudy.Enabled = false;
tbSubjects.Enabled = true;
tbExperience.Enabled = true;
tbGradDate.BackColor = Color.FromName("#f2f2f2");
tbFieldOfStudy.BackColor = Color.FromName("#f2f2f2");
tbSubjects.BackColor = Color.FromName("#ffffe1");
tbExperience.BackColor = Color.FromName("#ffffe1");
}
}
}
protected void CallbackRadioButton1_CheckedChanged(object sender, EventArgs e)
{
Update();
}
protected void CallbackButton1_Click(object sender, EventArgs e)
{
string gradeName = (CallbackRadioButton1.Checked) ? "student" : "teacher";
lbStatus.Text = tbFirstName.Text + " " + tbLastName.Text + " is successfully registered as a " + gradeName + ".";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -