页面传递多值的例子

asp.net 中 使用post方式页面传递多个值的例子


 

A.aspx

 

<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <asp:Button ID="btnShow" runat="server" Text="Click Me" onclick="btn_Click" /> <asp:GridView ID="gv" runat="server"></asp:GridView> <br /> <asp:Button ID="btnPost" Visible="false" runat="server" Text="Post" onclick="btnPost_Click" /> </form> <asp:Literal ID="lit" runat="server"></asp:Literal> </body> </html>

 

A.aspx.cs

页面传递多值的例子_第1张图片 A.aspx.cs part 2

 

B.aspx

 

<!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"> <asp:GridView ID="gv" runat="server"></asp:GridView> </form> </body> </html>

 

B.aspx.cs

 

protected void Page_Load(object sender, EventArgs e) { string values = Request.Form["hid"] ?? ""; if (values.Length > 0) { gv.DataSource = values.Split(','); gv.DataBind(); } }

你可能感兴趣的:(object,server,XHTML,asp.net,asp,button)