1. 程式人生 > >Asp.net後臺獲取input的值

Asp.net後臺獲取input的值

 想在後臺cs頁面得到前臺頁面aspx中html控制元件input輸入的值.

解決方法如下:

 1.用Request["name"].toString();.

前臺程式碼如下:

<input name="username" type="text">

後臺獲取程式碼如下:
string username = Request["username"].ToString();

2.用Request.Form.Get("name").ToString();

前臺程式碼如上一樣.

後臺獲取程式碼如下:

string username = Request.Form.Get("username").ToString();