表单元素的NAME或者ID
<input type='text' id='text_name' value='woody' />
string name=Request["text_name"];
详细
后台
string text = Request["text_name"];
string ck = Request["ck_box"];
string rd_in = Request ["rd_in"];
string select_id = Request["select_id"];
string txt_are = Request["txt_are"];
string psd = Request["psd"];
if (Request.Files.Count > 0)
{
HttpPostedFile hf = Request.Files["file_id"];
if (hf.ContentLength > 0)
{
Response.Write(hf.FileName);
}
}
Code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type='text' id='text_name' value='woody' runat="server" />
<input type="checkbox" id="ck_box" value="wood2" runat="server" />
<input type="file" id="file_id" runat="server" />
<input type="radio" id="rd_in" value="woody3" runat="server" />
<select id="select_id" runat="server">
<option value="SS">SS</option>
</select>
<textarea id="txt_are" runat="server">
</textarea>
<input type="password" id="psd" runat="server" />
<input type="submit" id="sub_btn" value="提交" />
</div>
</form>
</body>
</html>