We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Binding object to grid with dynamic properties

Thread ID:

Created:

Updated:

Platform:

Replies:

34774 Sep 15,2005 11:38 AM Oct 13,2005 12:18 PM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 15, 2005 11:38 AM

I''m not sure this is specific to Syncfusion, but I appreciate any help. I''ve got an entity object that contains a method called GetDollarsForWeek(int weekNumber), therefore passing in a week number will return a dollar total. Is there any way to bind an entity object to the GridDataboundGrid which binds a column to a method? Or is there a way to represent a dynamic number of properties within an entity object that can be binded to the grid? For example, a variable number of weeks? Thanks, Todd

suresh kumar
Replied On October 13, 2005 11:38 AM

con.Open(); ad=new SqlDataAdapter(sr,con); ds=new DataSet("suresh"); ad.Fill(ds,"suresh"); for(int i=0;i<=ds.Tables["suresh"].Columns.Count-1;i++) { this.gridControl1[0,i+1].Text = ds.Tables["suresh"].Columns[i].ColumnName.ToString(); this.gridControl1[0,i+1].Font.Bold = true; } for(int i=0;i<=ds.Tables["suresh"].Rows.Count-1;i++) { for(int j=0;j<=ds.Tables["suresh"].Columns.Count-1;j++) { this.gridControl1[i+1,j+1].Text =ds.Tables["suresh"].Rows[i].ItemArray.GetValue(j).ToString(); this.gridControl1[i+1,j+1].Font.Bold = true; } } con.Close();

Administrator [Syncfusion]
Replied On October 13, 2005 12:18 PM

To use a GridDataBoundGrid, your entity object would have to be some kind of IList. You can use a GridControl in virtual mode to bind to anything. In virtual mode, the grid raises an event (QueryCellInfo) when it wants data for a given row, col. And in your event handler, you could provide the data from wherever you wanted to get it, including calling methods on objects. Now, you would want such methods to be very efficient as QueryCellInfo is raised constantly, many, many, many times. Check the grid''s User Guide for information on virtual grids.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;