How do you set focus/highlight a particular row? I'd like to select a row and bring it to the top of the WebDataGrid within the PreRender sub base on a few cell values within the row. Thanks for any help!!!
Hello David,
Have you been able to resolve this issue ?
If you still have any questions, please do no hesitate to ask, I will be glad to help.For any furthur assistance contact us.
Sincerely,Georgi SashevDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support
Than you for posting this forum thread. I created a sample on your behalf which reproduces this case in the way I understood it. Handle the PreRender event f the WebDataGrid and invoke WebDataGrid1_PreRender method. Inside PreRender handler select a row, activate it and scroll down to this row.
protected void WebDataGrid1_PreRender(object sender, EventArgs e) { WebDataGrid1.Behaviors.Selection.SelectedRows.Add(WebDataGrid1.Rows[particularRowIndex]); WebDataGrid1.Behaviors.Activation.ActiveCell = WebDataGrid1.Rows[particularRowIndex].Items[1]; WebDataGrid1.ScrollTop = 31 * particularRowIndex; }
protected
void WebDataGrid1_PreRender(object sender, EventArgs e)
{
WebDataGrid1.Behaviors.Selection.SelectedRows.Add(WebDataGrid1.Rows[particularRowIndex]);
WebDataGrid1.Behaviors.Activation.ActiveCell = WebDataGrid1.Rows[particularRowIndex].Items[1];
WebDataGrid1.ScrollTop = 31 * particularRowIndex;
}
the particularRowIndex is set during the row initializing like this
if (e.Row.Items[1].Value.ToString() == "Item 300" )
if
)
Here you can include your own logic to define which exactly to be this particular row. Also note that we set the ScrollTop to be exactly 31 times particularRowIndex. The number is 31 because when you open the ig_dataGrid.css file in the ig_res\Default folder you can see the definition of the css class of the row. We have 20px height + 5px padding-top + 5px padding-bottom + 1pxborder-top
tbody.igg_Item>tr>td { background-color:White; border-top:solid 1px #D8D8D8; padding:5px 8px 5px 8px; overflow: hidden; height: 20px; text-align:left; vertical-align:middle; }
tbody.igg_Item>tr>td
background-color:White;
border-top:solid 1px #D8D8D8;
padding:5px 8px 5px 8px;
overflow: hidden;
height: 20px;
text-align:left;
vertical-align:middle;
Also you can follo this link for more datails about the WebDatagrid styling:
http://community.infragistics.com/blogs/engineering/archive/2010/08/25/webdatagrid-css-styling-guide.aspx
Attached I send you a sample that reproduses this. Thank you once again and hope this works for you.
For further help please do not hesitate to contact us.
Looking to hear from you soon.