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

DataGrid

Scheduled Pinned Locked Moved ASP.NET
helpquestion
5 Posts 3 Posters 2 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.
  • R Offline
    R Offline
    Ritwik Sanyal
    wrote on last edited by
    #1

    Hi all! Is it possible to generate different types of columns in datagrid in runtime? I mean to say , I have a datagrid on my page and if I want to add a asp:templatecolumn on a fly is it possible? If so then how? Please help. Thanks in advance.

    M V 2 Replies Last reply
    0
    • R Ritwik Sanyal

      Hi all! Is it possible to generate different types of columns in datagrid in runtime? I mean to say , I have a datagrid on my page and if I want to add a asp:templatecolumn on a fly is it possible? If so then how? Please help. Thanks in advance.

      M Offline
      M Offline
      Marcie Jones
      wrote on last edited by
      #2

      Hi Ritwik, Yep, it's possible to add columns dynamically. See this article for more details: TopQuestionsAboutASPNETDataGridServerControl For TemplateColumns, it's a bit more complicated. See this article for adding template columns dynamically: http://www.dotnetbips.com/displayarticle.aspx?id=84 Hope that helps! Datagrid Girl http://www.datagridgirl.com http://www.codeproject.com

      R 1 Reply Last reply
      0
      • R Ritwik Sanyal

        Hi all! Is it possible to generate different types of columns in datagrid in runtime? I mean to say , I have a datagrid on my page and if I want to add a asp:templatecolumn on a fly is it possible? If so then how? Please help. Thanks in advance.

        V Offline
        V Offline
        Venugopal Mallarapu
        wrote on last edited by
        #3

        Hi, You have all the different type of columns that you can include in a datagrid available to add to the datagrid dynamically. Dim aTemplateColumn As TemplateColumn aTemplateColumn = New TemplateColumn With aTemplateColumn 'Add various templates like Item Template etc. '.ItemTemplate = '.ItemStyle = End With DataGrid1.Columns.Add(aTemplateColumn) In a similar fashion you can even add more items like headers and footers. HTH Cheers, Venu.

        1 Reply Last reply
        0
        • M Marcie Jones

          Hi Ritwik, Yep, it's possible to add columns dynamically. See this article for more details: TopQuestionsAboutASPNETDataGridServerControl For TemplateColumns, it's a bit more complicated. See this article for adding template columns dynamically: http://www.dotnetbips.com/displayarticle.aspx?id=84 Hope that helps! Datagrid Girl http://www.datagridgirl.com http://www.codeproject.com

          R Offline
          R Offline
          Ritwik Sanyal
          wrote on last edited by
          #4

          Hi Marcie Your reply helps. Thanks for the reply. But can you help me on some thing!! The code which is there is working fine with c sharp, but when using vb.net I am not finding the proper way of writing the the following c sharp code in vb.net format. The code is for assigning event handler to the databind event of the literal control. In C sharp it is as following:- literal1.databinding+=new eventhandler(). But how can I write the same line in vb.net. Please help.

          M 1 Reply Last reply
          0
          • R Ritwik Sanyal

            Hi Marcie Your reply helps. Thanks for the reply. But can you help me on some thing!! The code which is there is working fine with c sharp, but when using vb.net I am not finding the proper way of writing the the following c sharp code in vb.net format. The code is for assigning event handler to the databind event of the literal control. In C sharp it is as following:- literal1.databinding+=new eventhandler(). But how can I write the same line in vb.net. Please help.

            M Offline
            M Offline
            Marcie Jones
            wrote on last edited by
            #5

            Hi Ritwik, I'm not sure why you would need an event handler for a literal, but in VB.NET, you would use: AddHandler literal1.DataBinding, AddressOf YourEventHandlerHere Marcie http://www.codeproject.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