需要从HTML页面传值给ASP.NET页面时,可以使用,很基本,保存下来,以备没学过ASP的新手们不急之需
<html>
<head>
<title>HTML Start Page</title>
</head>
<body>
<form id="Form1" method="post" action="WebForm1.aspx">
<input type="text" id="yourTextBox" name="yourTextBox" value="This is the HTML page TextBox value" />
<input type="hidden" id="yourHiddenElement" name="yourHiddenElement" value="This is the HTML page hidden element value" />
<input type="submit" value="Go" />
</form>
</body>
</html>
private void Page_Load(object sender, System.EventArgs e)
{
if ( !this.IsPostBack )
{
string textBoxValue = Request["yourTextBox"];
string hiddenElementValue = Request["yourHiddenElement"];
this.Response.Write("textBoxValue: " + textBoxValue + "<br>");
this.Response.Write("hiddenElementValue: " + hiddenElementValue + "<br>");
}
}
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |