Select full row in GridDataBoundGrid

Hi,

How to select a full row in gridDataBoundGrid.
When you click on the cell also, the cell style should be similar to the other cell of the selected row.

Also how to change the Font of the selected Row.


6 Replies

RC Rajadurai C Syncfusion Team December 16, 2008 11:06 AM UTC

Hi Champak,

Thanks for your interest in Syncfusion products.

1) You can select a full row by means of ListBoxSelectionMode property.

this.gridDataBoundGrid1.ListBoxSelectionMode = SelectionMode.One;


2) The cellstyle(font and style while editing) of a cell can be maintained as with other cells in the row selected with the ListBoxSelectionMode through the following event handler.

//event handler
this.gridDataBoundGrid1.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(gridDataBoundGrid1_PrepareViewStyleInfo);

void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if (e.RowIndex == cc.RowIndex)
{
e.Style.Font.Italic = true;
e.Style.BackColor = SystemColors.Highlight;
}
}


Regards,
Rajadurai



CC champak chaini December 16, 2008 01:35 PM UTC

I had set the SelectListBox property to One, and the whole row is selected but still when you click on a cell the cell is displayed as a text box and highlighted as cell, but other column of the selected row has same style.



RC Rajadurai C Syncfusion Team December 16, 2008 02:45 PM UTC

Hi Champak,

Thanks for your update.

Please refer the following sample in which i reproduced this issue.

http://www.syncfusion.com/support/user/uploads/F78490_ea1581e0.zip

I couldn't understand what you are insisting as style in other cells in that selectedrow.

If possible, please reproduce the behavior you are insisting in this sample or a screenshot showing the behavior and send us so that we could find a fix for it.

Regards,
Rajadurai



CC champak chaini December 17, 2008 12:34 PM UTC

Hi Rajadurai,

I have attached one sample. See the grid on the top, the whole row is selected, but since i clicked on the first column cell, the "Address Register Type" is shown differently than the second column and row header for the selected row.

I want something like the grid below, where ever you click on the same row, the style should be same. Also the selected row font should be bold.

Regards,
champak
>Hi Champak,

Thanks for your update.

Please refer the following sample in which i reproduced this issue.

http://www.syncfusion.com/support/user/uploads/F78490_ea1581e0.zip

I couldn't understand what you are insisting as style in other cells in that selectedrow.

If possible, please reproduce the behavior you are insisting in this sample or a screenshot showing the behavior and send us so that we could find a fix for it.

Regards,
Rajadurai





SyncfusionIssue_308507e.zip


RC Rajadurai C Syncfusion Team December 17, 2008 01:27 PM UTC

Hi Champak,

Thanks for your update.

I had gone through the screenshot sent.The sample sent by us in the last update solves this issue.For your reference, i'm attaching here a screenshot of the sample.
http://www.syncfusion.com/support/user/uploads/F78490a_2df8ddee.zip

Please let me know if you have any further concerns.

Regards,
Rajadurai



RC Rajadurai C Syncfusion Team December 17, 2008 01:31 PM UTC

Hi Champak,

To make the currentrow text to appear bold, please try the following code:

void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if (e.RowIndex == cc.RowIndex)
{
e.Style.Font.Bold = true;
e.Style.BackColor = SystemColors.Highlight;
}
}


Regards,
Rajadurai


Loader.
Up arrow icon