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. Grid with CheckBox Columns

Grid with CheckBox Columns

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

    Hi All, i have a textbox with numeric insert so if i worte 5 there, then i need to create a grid with 5 columns with checkboxes. So the column should add at runtime i can't define the template field at designtime, when i user checkboxfield to create checkbox column dynamically then the column created but the checkboxes is not appeared in the column. So what would the solution. plz do reply. Thanks Yogesh Agarwal

    A C 2 Replies Last reply
    0
    • Y yogesh_kumar_agarwal

      Hi All, i have a textbox with numeric insert so if i worte 5 there, then i need to create a grid with 5 columns with checkboxes. So the column should add at runtime i can't define the template field at designtime, when i user checkboxfield to create checkbox column dynamically then the column created but the checkboxes is not appeared in the column. So what would the solution. plz do reply. Thanks Yogesh Agarwal

      A Offline
      A Offline
      Arun Jacob
      wrote on last edited by
      #2

      No need to create it dynamically.Create a Templated Gridview and when user enters value in textbox, create a datasource with that specified number of rows and bind it to grid.

      Arun Jacob http://codepronet.blogspot.com/

      Y 1 Reply Last reply
      0
      • A Arun Jacob

        No need to create it dynamically.Create a Templated Gridview and when user enters value in textbox, create a datasource with that specified number of rows and bind it to grid.

        Arun Jacob http://codepronet.blogspot.com/

        Y Offline
        Y Offline
        yogesh_kumar_agarwal
        wrote on last edited by
        #3

        But i dont know how much column has to created because no. of columns is dynamic according to the numbers user enters. So how many template field i have to created.

        A 1 Reply Last reply
        0
        • Y yogesh_kumar_agarwal

          Hi All, i have a textbox with numeric insert so if i worte 5 there, then i need to create a grid with 5 columns with checkboxes. So the column should add at runtime i can't define the template field at designtime, when i user checkboxfield to create checkbox column dynamically then the column created but the checkboxes is not appeared in the column. So what would the solution. plz do reply. Thanks Yogesh Agarwal

          C Offline
          C Offline
          chengclq
          wrote on last edited by
          #4

          HI,this is my idea: 1、you can add a table with runing at service in UI 2、create table tb=new row() 3、crate cell c = new cell() 4、ch = new chkbox() 5、c.add.control(ch) 6、tb.add(c) 7、tablName.add(tb) you can add dynamic table cell so...i don't know than can help you .

          1 Reply Last reply
          0
          • Y yogesh_kumar_agarwal

            But i dont know how much column has to created because no. of columns is dynamic according to the numbers user enters. So how many template field i have to created.

            A Offline
            A Offline
            Arun Jacob
            wrote on last edited by
            #5

            Where this column name coming from?I mean where this column is mapped to?Where you get the no of records from? if the column is only dynamic and you know the no of records, then you can try any of the following solution.I guess it'll work, Either 1.Add Template column for check box and make AutoGenerateColumns true. Add dynamic columns to the datasource and bind it to grid. or 2.Create a datasource with no of records, Bind the grid with the DataSource and add the dynamic columns in the Row_Created event.

            Arun Jacob http://codepronet.blogspot.com/

            Y 1 Reply Last reply
            0
            • A Arun Jacob

              Where this column name coming from?I mean where this column is mapped to?Where you get the no of records from? if the column is only dynamic and you know the no of records, then you can try any of the following solution.I guess it'll work, Either 1.Add Template column for check box and make AutoGenerateColumns true. Add dynamic columns to the datasource and bind it to grid. or 2.Create a datasource with no of records, Bind the grid with the DataSource and add the dynamic columns in the Row_Created event.

              Arun Jacob http://codepronet.blogspot.com/

              Y Offline
              Y Offline
              yogesh_kumar_agarwal
              wrote on last edited by
              #6

              For now i create the columns with the name 1,2,3,... for loops counter value. and i dont want to bind it with any database table. i used the following code to create the column for now **loop** CheckBoxField cf=new CheckBoxField(); cf.HeaderText=i.toString(); gridview.columns.add(cf) **End Loop** it creates the column for me but no checkbox appears there

              A 1 Reply Last reply
              0
              • Y yogesh_kumar_agarwal

                For now i create the columns with the name 1,2,3,... for loops counter value. and i dont want to bind it with any database table. i used the following code to create the column for now **loop** CheckBoxField cf=new CheckBoxField(); cf.HeaderText=i.toString(); gridview.columns.add(cf) **End Loop** it creates the column for me but no checkbox appears there

                A Offline
                A Offline
                Arun Jacob
                wrote on last edited by
                #7

                How you are binding your gridview?Whats the DataSource?

                Arun Jacob http://codepronet.blogspot.com/

                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