变量获得的值始终是加载出来的值

protected void Page_Load(object sender, EventArgs e)
{
txtName.Text = Request.QueryString["bname"];
txtAuthor.Text = Request.QueryString["bauthor"];
txtprice.Text=Request.QueryString["bprice"];
TextBox1.Text=Request.QueryString["bid"];
TextBox1.ReadOnly = true;
}

    protected void btnSave_Click(object sender, EventArgs e)
    {

        string i=TextBox1.Text;
        string n = txtName.Text;
        string a = txtAuthor.Text;
        string p = txtprice.Text;
                    不管怎么修改文本框的值,那几个变量的值始终是原来的值。

if (!ispostback)
{
txtName.Text = Request.QueryString["bname"];
txtAuthor.Text = Request.QueryString["bauthor"];
txtprice.Text=Request.QueryString["bprice"];
TextBox1.Text=Request.QueryString["bid"];
TextBox1.ReadOnly = true;
}

因为txtName.Text等一直保存着刚开始的赋值。你每一次修改文本框的值后,需要调用Page_Load方法,重新把文本框的值赋给txtName.Text等,然后调用btnSave_Click才会有效。