下面是我的测试代码:
Default.aspx.cs的代码如下:
using System;
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.Net;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
System.Web.HttpCookie hp = new HttpCookie("UserName", this.TextBox1.Text);
System.Web.HttpContext.Current.Response.Cookies.Add(hp);
this.Label1.Text = System.Web.HttpContext.Current.Response.Cookies.Get("UserName").Value;
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
string xxx = RadioButtonList1.SelectedItem.Value;
Response.Write(xxx);
this.Label1.Text = xxx;
this.TextBox1.Text = xxx;
}
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
string xxx = this.RadioButton1.Text;
this.Label1.Text = xxx;
this.TextBox1.Text = xxx;
}
protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
string xxx = this.RadioButton2.Text;
this.Label1.Text = xxx;
this.TextBox1.Text = xxx;
}
protected void RadioButton3_CheckedChanged(object sender, EventArgs e)
{
string xxx = this.RadioButton3.Text;
this.Label1.Text = xxx;
this.TextBox1.Text = xxx;
}
}
Default.aspx的代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
是POST实现么?还是用js实现?