Dynamic Data-binding in C#

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

    #1

    Dynamic Data-binding in C#

    Hi,

    I have a grid that displays a few columns of data obtained from a
    stored procedure. Now under certain condition, I'll need to add an
    additional column to the same grid whose data are obtained from a
    second stored procedure.

    After I put my code in, the second stored procedure seems to be called
    when the condition is met. However, the additional column is still
    missing from the grid.

    I believe that I'll need to add the column to the grid specifically in
    the code. However, I'll need to get the column added dynamically only
    when the condition is met. Could anyone advise me on how to do this?

    Thanks!

    -Emily

  • Phil

    #2
    Re: Dynamic Data-binding in C#

    On 19 Jul 2006 14:41:48 -0700, "Fir5tSight " <fir5tsight@yah oo.com>
    wrote:
    >Hi,
    >
    >I have a grid that displays a few columns of data obtained from a
    >stored procedure. Now under certain condition, I'll need to add an
    >additional column to the same grid whose data are obtained from a
    >second stored procedure.
    >
    >After I put my code in, the second stored procedure seems to be called
    >when the condition is met. However, the additional column is still
    >missing from the grid.
    >
    >I believe that I'll need to add the column to the grid specifically in
    >the code. However, I'll need to get the column added dynamically only
    >when the condition is met. Could anyone advise me on how to do this?
    >
    >Thanks!
    >
    >-Emily
    Not really enough information in your post...but adding (or
    showing/hiding) a new column can be done via the grid's Columns
    collection. Also check out the AutoGenerateCol umns property of the
    DataGridView (it's a pain that this is not available in the properties
    window).

    --
    Phil

    Comment

    • Fir5tSight

      #3
      Re: Dynamic Data-binding in C#

      Hi Phil,

      Thanks for responding! You're right that this is in the column
      collection. I've created classes that would return all of the columns
      (including the additional column) for a data set.

      Therefore, I have two data sets in the program. One is the old one. The
      other is the new one that includes the additional column.

      I'll need to figure out where to set the new data set as data source to
      the grid so that the grid can display all of the columns. Any advice on
      that?

      -Emily

      Comment

      Working...