post和get传值


//post传值
send.aspx:

 if (e.CommandName == "ChaXun")
        {
            LinkButton Lik=(LinkButton)e.Item.FindControl("LinkButton1");
            Context.Items["username"] =Lik.CommandArgument.ToString();
            Server.Transfer("Default2.aspx");
 或者直接用按钮事件:

 protected void Button1_Click(object sender, EventArgs e)
    {
        Context.Items["username"] =Lik.CommandArgument.ToString();
            Server.Transfer("Default2.aspx");
    }

recive.aspx:

string TextBox1 = Context.Items["username"].ToString();
            Response.Write(TextBox1);

get传值:
send:
<asp:LinkButton ID="LinkButton1" runat="server"  PostBackUrl='<%# "~/Default2.aspx?PKID="+Eval("ID") %>'>

receive:
string str= Request["PKID"];

你可能感兴趣的:(post)