Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1005
How do you set focus/highlight a particular row
posted

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!!!

  • 7566
    posted

    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 Sashev
    Developer Support Engineer
    Infragistics, Inc.
    http://ko.infragistics.com/support

  • 7566
    posted

    Hello David,

     

    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;

    }

    the particularRowIndex is set during the row initializing like this

    if

     

     

     

    (e.Row.Items[1].Value.ToString() == "Item 300"

    )

    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;

    }

     

    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.

    Sincerely,
    Georgi Sashev
    Developer Support Engineer
    Infragistics, Inc.
    http://ko.infragistics.com/support

  • 7566
    posted

    Hello David,

     

    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;

    }

    the particularRowIndex is set during the row initializing like this

    if

     

     

     

    (e.Row.Items[1].Value.ToString() == "Item 300"

    )

    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;

    }

     

    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.

    Sincerely,
    Georgi Sashev
    Developer Support Engineer
    Infragistics, Inc.
    http://ko.infragistics.com/support

    WebDataGrid.zip