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.
Syncfusion Feedback

caption for databound grid

Thread ID:

Created:

Updated:

Platform:

Replies:

49671 Sep 22,2006 07:10 PM UTC Oct 17,2006 09:38 PM UTC Windows Forms 7
loading
Tags: GridControl
Charlie Mao
Asked On September 22, 2006 07:10 PM UTC

I was wondering how to set the caption text on a databound grid. I want to set a title or label above my grid without having to use a seperate label. thanks

Administrator [Syncfusion]
Replied On September 25, 2006 05:48 AM UTC

Hi Charlie,

Try setting the Rows.HeaderCount property to add the number of extra header in a grid and also call the CoveredRanges.Add(GridRangeInfo.Row(0)) to make the ZERO th row as covered cell. Below is a code snippet

this.grid.Model.Rows.HeaderCount = 1;

for(int i = 1; i <= this.grid.Model.ColCount;i++)
this.grid.Model[1,i].Text = this.grid.Model[0,i].Text ;

this.grid.Model.CoveredRanges.Add(GridRangeInfo.Row(0));
this.grid.Model[0,0].Text = dt.TableName;

this.grid.ThemesEnabled = true;

Thanks,
Haneef

Charlie Mao
Replied On October 12, 2006 12:06 AM UTC

Hey Haneef,

I tried the below code and the test appears on the top left corner instead of the first row above the grid. Can you help me fix this.

this.dataGridAPS.Model.Rows.HeaderCount = 1;

for(int i = 1; i <= this.dataGridAPS.Model.ColCount;i++)
this.dataGridAPS.Model[1,i].Text = this.dataGridAPS.Model[0,i].Text ;

this.dataGridAPS.Model.CoveredRanges.Add(GridRangeInfo.Row(0));
this.dataGridAPS.Model[0,0].Text = "Proposal A";

Please refer to the picture for clarity.

>Hi Charlie,

Try setting the Rows.HeaderCount property to add the number of extra header in a grid and also call the CoveredRanges.Add(GridRangeInfo.Row(0)) to make the ZERO th row as covered cell. Below is a code snippet

this.grid.Model.Rows.HeaderCount = 1;

for(int i = 1; i <= this.grid.Model.ColCount;i++)
this.grid.Model[1,i].Text = this.grid.Model[0,i].Text ;

this.grid.Model.CoveredRanges.Add(GridRangeInfo.Row(0));
this.grid.Model[0,0].Text = dt.TableName;

this.grid.ThemesEnabled = true;

Thanks,
Haneef

caption.zip

Charlie Mao
Replied On October 13, 2006 05:30 PM UTC

Anyone knows how to set captions to a data bound grid?

Administrator [Syncfusion]
Replied On October 16, 2006 06:44 AM UTC

Hi Charlie,

Please refer to the attached sample for more details.

//It implements the QueryCoveredRange event to manually set the covered range of the cell in a grid.
Sample : http://www.syncfusion.com/Support/user/uploads/GDBGCoveredRange_68674e6b.zip

Let me know if you are looking something different.

Best Regards,
Haneef

Charlie Mao
Replied On October 17, 2006 07:14 PM UTC

Hey Haneef,

This code was very helpful. It worked great. I was wondering if this could be modified a little though. Right now, it is putting the caption on the same row as my heading. I was wondering if the caption can be on one row by itself and then below that would be my 2nd header, then the grid data. I attached a screenshot of what I am getting as of now. Thanks so much.

Charlie

screenshot27.zip

Charlie Mao
Replied On October 17, 2006 07:44 PM UTC

Actually Haneef,

What I am finding is that the caption row when inserted is not pushing my other header down. The screenshot I sent you is with this line commented out:
this.dataGridA.Model.CoveredRanges.Add(GridRangeInfo.Row(0));

When I leave this line in, the caption row appears to show up on top of my header row. Any suggestions???

Charlie Mao
Replied On October 17, 2006 09:38 PM UTC

Hi Haneef,

I think I found out the problem. Thanks for your help.

Charlie

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.

Warning Icon 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.Close Icon

;