close
如果需要用HTML的方式POST到後端處理的話
可以使用Request.Form["HTML的name"]來取值
test.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="test.aspx" method="post" style="background-color:#FFFF99"> | |
<input id="test1" name="test1" type="text" /> <!--注意!!name屬性一定要寫,後端是以這個當id來抓值 --> | |
<br/> | |
<input id="Submit1" type="submit" value="send" /> | |
</form> |
test.aspx.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Page_Load(object sender, EventArgs e) | |
{ | |
var str = Request.Form["test1"]; | |
Response.Write(str); | |
} |
全站熱搜