Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Custom Datagrid Help! Header text disappears on Post Back!

Custom Datagrid Help! Header text disappears on Post Back!

Scheduled Pinned Locked Moved ASP.NET
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dgap
    wrote on last edited by
    #1

    Hi All, I am creating a custom Datagrid but on any postback all of the text for the Header disappears! If I do a "this.Parent.Page.DataBind()" the header reappears...but I lose all of the data changes that were made to the datagrid! Any ideas as to why a postback would clear out my header? And how I can fix this? Many thanks in advance! BTW, Mihir, I really appreciate all of your help... your suggestions for my other problem helped alot and that part is working now :o)

    M 1 Reply Last reply
    0
    • D dgap

      Hi All, I am creating a custom Datagrid but on any postback all of the text for the Header disappears! If I do a "this.Parent.Page.DataBind()" the header reappears...but I lose all of the data changes that were made to the datagrid! Any ideas as to why a postback would clear out my header? And how I can fix this? Many thanks in advance! BTW, Mihir, I really appreciate all of your help... your suggestions for my other problem helped alot and that part is working now :o)

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, When you call the DataBind method, you can force the datagrid to build its control hierarchy based on the specify datasource. When the page posts back, you need to provide your logic to build the control hierarchy again. To do that you simply override the CreateChildControls method in your custom datagrid, and provide your logic in there. You can see the document for more information: Developing a Templated Data-Bound Control [^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups