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

GridDataboundGrid: enumerating rows like in GridControl

Thread ID:

Created:

Updated:

Platform:

Replies:

95970 Aug 12,2010 02:02 PM UTC Aug 16,2010 01:06 PM UTC Windows Forms 3
loading
Tags: GridControl
Dani Knopf
Asked On August 12, 2010 02:02 PM UTC

Hi

Is it possible to enumerate the rows in a GridDataBoundGrid?
There are many examples where this is done in the GridControl but none with the GridDataboundGrid. ( For example in the Grid Performance Demo (Grid samples->Data Bound->Gird Performance Demo) the Virtual GridControl does have an enumerated column, the GridDataBoundGrid does not)

(As a workaround it would be possible to no longer display the first column, which is not actually bound but is always there, and add a custom column to display the numbers. However, this is a workaround a really dont like and I havent yet managed to hide that first column to select entire rows. )

It would be very nice if enumerating was possible with the GridDataboundGrid.

Greetings and thanks in advance

Daniel

Nirmal Raja [Syncfusion]
Replied On August 13, 2010 12:23 PM UTC

Hi Daniel,

Thank you for your interest in Syncfusion products.

If want to iterate the rows through the events such as QueryCellInfo in GridControl, then you can use the PrepareViewStyleInfo which goes through the elements of the GridDataBoundGrid as row index and column index as the argument.

Please refer the sample attached in the below location:
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=RowBackColor2015614009.zip

Let me know if you have any queries.

Regards,
Nirmal

Dani Knopf
Replied On August 13, 2010 03:48 PM UTC

Hi

Thanks a lot for your answer. Unfortunately, it does not work when i use the event as follows:

void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if(e.ColIndex==0)
{
e.Style.Text = e.RowIndex.ToString();
}

...

Only in the top row (header row) appears the correct number (0). The others remain empty.

What can I do about this?

Best regards.


Nirmal Raja [Syncfusion]
Replied On August 16, 2010 01:06 PM UTC

Hi Daniel,

The event will provide only for the display cell and not the header cell. As the column index zero represent the column hader and if you need to have text in it then you have to change the header as static and then you can assign its value.

Please refer the code below:
void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if(e.ColIndex==0)
{
e.Style.CellType = "Static";
e.Style.Text = e.RowIndex.ToString();
}
}

Let me know if you have any queries.

Regards,
Nirmal

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

;