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. Dynamic columns in grid view

Dynamic columns in grid view

Scheduled Pinned Locked Moved ASP.NET
csshelpquestion
4 Posts 3 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.
  • J Offline
    J Offline
    jinovv
    wrote on last edited by
    #1

    Hi, I wrote a function for dynamically create some bound columns and template field in grid view.The template field having check box in header template and item template. First i have called this function on Page_load (!IsPostBack). This will work fine. Then i have checked the check box and click on a button(for delete the checked rows), the check box disappers.After the click event,if i am trying to access the check box from page load ,it returns null.I couldnt access the dynamically created checkbox . Why it happening? How will i solve this problem? Thanks

    L 1 Reply Last reply
    0
    • J jinovv

      Hi, I wrote a function for dynamically create some bound columns and template field in grid view.The template field having check box in header template and item template. First i have called this function on Page_load (!IsPostBack). This will work fine. Then i have checked the check box and click on a button(for delete the checked rows), the check box disappers.After the click event,if i am trying to access the check box from page load ,it returns null.I couldnt access the dynamically created checkbox . Why it happening? How will i solve this problem? Thanks

      L Offline
      L Offline
      Laddie
      wrote on last edited by
      #2

      See when you click a button or and the page loads what ever is there inside !isPostback will be discarded. You will require to call the binding function in the button click event to get it created again. Or put it outside !IspostBack

      Thanks Laddie Kindly rate if the answer was helpful

      J 1 Reply Last reply
      0
      • L Laddie

        See when you click a button or and the page loads what ever is there inside !isPostback will be discarded. You will require to call the binding function in the button click event to get it created again. Or put it outside !IspostBack

        Thanks Laddie Kindly rate if the answer was helpful

        J Offline
        J Offline
        jinovv
        wrote on last edited by
        #3

        Hi, Thanks for you reply.But there is another problem. In the buttton click, all other columns expect template field is there as such. The template column is there ,but the control is invisible.If i am creating the control outside !ispostback then i couldnt get the checked row for deletion. How will solve this.

        N 1 Reply Last reply
        0
        • J jinovv

          Hi, Thanks for you reply.But there is another problem. In the buttton click, all other columns expect template field is there as such. The template column is there ,but the control is invisible.If i am creating the control outside !ispostback then i couldnt get the checked row for deletion. How will solve this.

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          jinovv wrote:

          If i am creating the control outside !ispostback then i couldnt get the checked row for deletion.

          Are you creating dynamic controls ? If yes this would be a viewstate problem. Controls created in page_load event won't maintain viewstate. Try any event which fires before viewstate is saved.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

          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