PC Review


Reply
Thread Tools Rate Thread

Dynamic Data-binding in C#

 
 
Fir5tSight
Guest
Posts: n/a
 
      19th Jul 2006
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

 
Reply With Quote
 
 
 
 
Phil
Guest
Posts: n/a
 
      20th Jul 2006
On 19 Jul 2006 14:41:48 -0700, "Fir5tSight" <(E-Mail Removed)>
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 AutoGenerateColumns property of the
DataGridView (it's a pain that this is not available in the properties
window).

--
Phil

 
Reply With Quote
 
Fir5tSight
Guest
Posts: n/a
 
      21st Jul 2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie question: WPF Data Binding - when to use "dynamic resource" indtaz Microsoft C# .NET 1 29th Feb 2008 11:00 AM
Dynamic two-way data binding AM Microsoft ASP .NET 0 21st Apr 2006 04:43 PM
DataGrid, templateColumn, custom controls and dynamic data binding Chu Microsoft ASP .NET 0 13th Apr 2006 11:22 PM
Dynamic Data binding Phuff Microsoft Dot NET Framework 2 7th Sep 2005 02:29 PM
How do I create dynamic data binding? Tobias Johansson Microsoft C# .NET 1 21st Mar 2004 09:44 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:17 PM.