Gridview dynamic columns

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jimmysjams

    Gridview dynamic columns

    I'm modifying someone else's code and I have hit a snag. I don't
    want
    to rewrite what's already there but I might have to.

    I have a gridview, in the gridview is a set number of columns that
    will always be there. On the end of the gridview I need to add
    columns
    dynamically. These columns may or may not exist and I don't know how
    many there will be. The way it is currently programmed, there are 2
    gridviews, one for viewing a list and one for editing the list. So
    the gridview is either being editted or it's being viewed. The way
    the editted gridview is saved is by looping through each row, finding
    the value in certain controls, and saving a list generated with the
    values extracted.


    Here's the problem, I can add and view columns in both gridviews by
    adding new table cells to each row, but when I go to extract the
    values within the code of the process described above, the gridview
    doesn't have the additional columns. My question is, how do I add a
    control to a gridview after it has been bound and then extract the
    value from it? I'd prefer to not rewrite what's already there and
    working, but is there an easier or better way to accomplish the same
    goal? Thank you for your help in advance.
  • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

    #2
    RE: Gridview dynamic columns

    Jimmy,
    A GridView is an ASP.NET control, this is the C# language group. I think
    you'll get a better response in the ASP.NET newsgroup.
    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    Short Urls & more: http://ittyurl.net


    "jimmysjams " wrote:
    I'm modifying someone else's code and I have hit a snag. I don't
    want
    to rewrite what's already there but I might have to.
    >
    I have a gridview, in the gridview is a set number of columns that
    will always be there. On the end of the gridview I need to add
    columns
    dynamically. These columns may or may not exist and I don't know how
    many there will be. The way it is currently programmed, there are 2
    gridviews, one for viewing a list and one for editing the list. So
    the gridview is either being editted or it's being viewed. The way
    the editted gridview is saved is by looping through each row, finding
    the value in certain controls, and saving a list generated with the
    values extracted.
    >
    >
    Here's the problem, I can add and view columns in both gridviews by
    adding new table cells to each row, but when I go to extract the
    values within the code of the process described above, the gridview
    doesn't have the additional columns. My question is, how do I add a
    control to a gridview after it has been bound and then extract the
    value from it? I'd prefer to not rewrite what's already there and
    working, but is there an easier or better way to accomplish the same
    goal? Thank you for your help in advance.
    >

    Comment

    Working...