title: persistent text boxes in c# asp.net
body: <p>I fill the textboxes on page_load event.Then I edit textboxes data and tried to update data. Variables are assigned with old values. How can I do to get the new values.<br>
  Here is my code behind  </p>
  
  <pre><code>using System;
  using System.Collections.Generic;  
  using System.Linq;  
  using System.Web;  
  using System.Web.UI;  
  using System.Web.UI.WebControls;  
  using System.Web.Configuration;  
  using System.Data;  
  using System.Data.SqlClient;  
  
  public partial class mymembertype : System.Web.UI.Page
  {
      public static int mem_typeid;
  
  protected void Page_Load(object sender, EventArgs e)
  {
      if (Session["valueid"] != null)
      {
          mem_typeid = (int)(Session["valueid"]);
          string memtype_name = Convert.ToString(Session["valueName"]);
          string rate = Convert.ToString(Session["rate"]);
          txtmembtype.Text = Convert.ToString(memtype_name);
          txtdscrate.Text = rate;
          Insert_membertype.Text = "Update";
      }
      }
  
  protected void Insert_membertype_Click(object sender, EventArgs e)
  {
  
      funtions fun = new funtions();
  
  
          if (txtmembtype.Text != "" &amp;&amp; txtdscrate.Text != "" )
          {
              if (Insert_membertype.Text == "Save")
              {   
                  string membetype = txtmembtype.Text;
                  int dscrate = Convert.ToInt32(txtdscrate.Text);
  
                  bool chk = fun.Insert_membertype(membetype, dscrate);
                  if (chk)
                      lblInfo.Text = " saving membertype successful";
                  else
                      lblInfo.Text = "Error saving membertype";
  
          }
  
      else
      {
  
                  string membetype = txtmembtype.Text;
                  int dscrate = Convert.ToInt32(txtdscrate.Text);
  
                  bool chk = fun.Update_memberType(mem_typeid, membetype, dscrate);
                  if (chk)
                      lblInfo.Text = " Updating membertype successful";
                  else
                      lblInfo.Text = "Error Updating membertype";
              }
          }
  
  
      }
  
  
  }  
  </code></pre>
  
  <p>As you see second condition block is for updating data. But it have only values in page load.Now new data is assigned. Please ....</p>