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
440
Conditionally Hiding Bound Check Box Column/Cell By Row
posted

Hi,

I'd like to be able to conditionally hide my bound checkbox column/cell by row.

For example:

I have 10 rows in my grid. Based on a condition, 3 of those rows should have the checkbox visible and the rest should be hidden.

How can I achieve this?

Thanks!

Parents
No Data
Reply
  • 17559
    posted

    Hello Khaled,

     

    You can hide some of the check boxes by handling the InitializeRow event of the WebDataGrid and setting a css class to some of the cells. For example if you want to hide the checkboxes of every second row you can try the following:

     

     

        protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
        {
            if (e.Row.Index % 2 == 0)
            {
                e.Row.Tag = true;
                e.Row.Items[3].CssClass = "disabled";
            }
        }
    

    in css:

     

        <style type="text/css">
        .disabled
        {
            visibility:collapse;
        }
        </style>
    

     

    For additional reference you can check the attached sample.

     

    If you need any further assistance on this do not hesitate to ask.

    WebDataGridDisableSomeCheckBoxes (2).zip
Children