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. DataGrid TemplateColumn ViewState

DataGrid TemplateColumn ViewState

Scheduled Pinned Locked Moved ASP.NET
question
7 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.
  • P Offline
    P Offline
    Plunging_Falcon
    wrote on last edited by
    #1

    Me again :) In a web application I'm writing I have a datagrid with template columns that I use for filtering of another datagrid. What i do is add 1 row to the template columns datagrid and load appropriate controls (textboxes,dropdownlists,etc.) to give the user the option to enter values. It works fine, the filtering is done, but the thing is that after postback all the selected values of the columns disappear - textboxes become blank, etc. What can I do to keep the viewstate? ViewState is enabled for both the controls and the datagrid.

    S U 2 Replies Last reply
    0
    • P Plunging_Falcon

      Me again :) In a web application I'm writing I have a datagrid with template columns that I use for filtering of another datagrid. What i do is add 1 row to the template columns datagrid and load appropriate controls (textboxes,dropdownlists,etc.) to give the user the option to enter values. It works fine, the filtering is done, but the thing is that after postback all the selected values of the columns disappear - textboxes become blank, etc. What can I do to keep the viewstate? ViewState is enabled for both the controls and the datagrid.

      S Offline
      S Offline
      Syed Abdul Khader
      wrote on last edited by
      #2

      When you are adding the controls? You have to do it during ItemCreated event of the Datagrid. Then it will work. I dont know why.

      P 1 Reply Last reply
      0
      • S Syed Abdul Khader

        When you are adding the controls? You have to do it during ItemCreated event of the Datagrid. Then it will work. I dont know why.

        P Offline
        P Offline
        Plunging_Falcon
        wrote on last edited by
        #3

        No, the controls are static. I am not adding anything programmatically.

        S 1 Reply Last reply
        0
        • P Plunging_Falcon

          No, the controls are static. I am not adding anything programmatically.

          S Offline
          S Offline
          Syed Abdul Khader
          wrote on last edited by
          #4

          Can you post the code so that I can try.

          1 Reply Last reply
          0
          • P Plunging_Falcon

            Me again :) In a web application I'm writing I have a datagrid with template columns that I use for filtering of another datagrid. What i do is add 1 row to the template columns datagrid and load appropriate controls (textboxes,dropdownlists,etc.) to give the user the option to enter values. It works fine, the filtering is done, but the thing is that after postback all the selected values of the columns disappear - textboxes become blank, etc. What can I do to keep the viewstate? ViewState is enabled for both the controls and the datagrid.

            U Offline
            U Offline
            utsav_verma
            wrote on last edited by
            #5

            When exactly r u adding data to controls...! Adding data shld not be static i guess. Utsav

            P 1 Reply Last reply
            0
            • U utsav_verma

              When exactly r u adding data to controls...! Adding data shld not be static i guess. Utsav

              P Offline
              P Offline
              Plunging_Falcon
              wrote on last edited by
              #6

              maybe i didn't make this clear... I am NOT adding data, except for one place, and anyway the data stays there. My problem is that if say I have a dropdown list and i choose a value and then hit a button that analyzes what i chose in that dropdown ==> the operation does happen, i.e. the data remains there "enough time" after postback, but the dropdown list itself gets reset: The value I chose is not the selected one anymore. Hope it is clearer now.

              U 1 Reply Last reply
              0
              • P Plunging_Falcon

                maybe i didn't make this clear... I am NOT adding data, except for one place, and anyway the data stays there. My problem is that if say I have a dropdown list and i choose a value and then hit a button that analyzes what i chose in that dropdown ==> the operation does happen, i.e. the data remains there "enough time" after postback, but the dropdown list itself gets reset: The value I chose is not the selected one anymore. Hope it is clearer now.

                U Offline
                U Offline
                utsav_verma
                wrote on last edited by
                #7

                Well well well, unfortunately u r rite, i tried it n find the same thing, let me wait 4 some correct solution of ur problem, it'd help me too now Utsav

                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