title: put gridview on a updatepanel
body: <p>First I'm a beginner at ASP.NET. I know a lot of classic ASP. </p>
  
  <p>I'm working on a application/framework oracle utilities. In the past I have created 'clips' in classic ASP, which are gridviews. There several clips positioned on a web page. All these gridviews do have page indexing. At this moment there 5 records per grid shown. So if there ar 18 records then there are 4 pages.</p>
  
  <p>The paging, data binding etc. is working fine.</p>
  
  <p>BUT what I already said there are several clips on a page. And for instance the user want to look at a clip at the middle of the page. When he click on the next page for that clip a submit is executed and the whole page is submitted and positioned at the top of the page. That is not user friendly because the user have to search/scroll down to the clip where he was looking at.</p>
  
  <p>Were I'm looking for, I don't know if I say it correctly, to bind every gridview of a clip to his own update panel, so that if the user clicks on the next page of a certain gridview, only that gridview is refreshed and not the complete page (AJAX?).</p>
  
  <p>Here is the code:</p>
  
  <pre><code>namespace Lodestar.Web.WebParts {
      public class CustomerCustomWebpartGasGVExSub : WebPart {
          //define variables
  
          private GridView CustConGrid;
          //I have defined this by myself
          private UpdatePanel UpdatePanel1;
  
          private LiteralControl LinkBox;
  
          public override string Title {
              get {
                  return _title;
              }
              set {
                  _title = value;
              }
          }
  
          //construtor
          public CustomerCustomWebpartGasGVExSub() {}
  
          protected override void CreateChildControls() {
              Controls.Clear();
  
              //Create the contract view.
              CustConGrid = new GridView();
              CustConGrid.EnableTheming = true;
          CustConGrid.SkinID = "CompacGrid";
          CustConGrid.PageSize = 5;
          CustConGrid.AllowPaging = true;
          CustConGrid.AutoGenerateColumns = false;
          CustConGrid.EmptyDataText = I18n.FM("GVClip_NoContracts");
  
          //I have defined this by myself    
          UpdatePanel1 = new UpdatePanel(); 
  
          //Create the db instance and retrieve the Customer UID and ID from the session page.
          ....
          using (DataTable dt = db.GetEntity("CUSTOMER", filter)) {
              //Retrieve the Customer information from the database.
              ....                
              //Render the contract table panel.
  
              using (DataTable cdt = TableFromReader(cdb.GetDataReader(xslFileGasGV, "StoredProcedure", lsdbparams, 9999, 1))) {
  
              }
  
              //Contract ID
              HyperLinkField ContractIdFld = new HyperLinkField();
              ContractIdFld.HeaderText = I18n.FM("ContractID");
              ContractIdFld.DataTextField = "CONTRACTID";
              ContractIdFld.DataNavigateUrlFields = new string[] {"UIDC"};
              string url = string.Format("~/..../..../......asp?SessionId={0}", HttpContext.Current.Server.UrlEncode(SessionContext.Id));
              ContractIdFld.DataNavigateUrlFormatString = url + "&amp;UIDC={0}";
              CustConGrid.Columns.Add(ContractIdFld);
  
              //Revision
              BoundField RevisionFld = new BoundField();
              RevisionFld.HeaderText = I18n.FM("GRevision");
              RevisionFld.DataField = "REVISION";
              CustConGrid.Columns.Add(RevisionFld);
  
              //Contract Type Code
  
              //Category
  
              //Status
  
              //Bind and add row
              CustConGrid.PageIndexChanging += new GridViewPageEventHandler(CustConGrid_PageIndexChanging);
              Controls.Add(CustConGrid);
              CustConGrid.DataBind();
          //UpdatePanel1.PageIndexChanging += new    GridViewPageEventHandler(CustConGrid_PageIndexChanging);
  //Tried something by myself, but is not working
  UpdatePanel1.ContentTemplateContainer.Controls.Add(CustConGrid);
              }
          }
  
          protected override void RenderContents(HtmlTextWriter writer) {}
  
          public DataTable TableFromReader(IDataReader dr) {}
  
          void CustConGrid_PageIndexChanging(object sender, GridViewPageEventArgs e)
          {
              CustConGrid.PageIndex = e.NewPageIndex;
              CustConGrid.DataBind();
          }
  
          private void GetSessionInfo() {}
      }
  }
  </code></pre>