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
1055
Disable unbound check box column in row
posted

Hi,

I just updated to latest version and wanted to use the new unbound check box column. It works fine but I have a question:

Is there a way to disable the check box in initial row event for some rows?

 

Parents
No Data
Reply
  • 49378
    Verified Answer
    posted

    Hi Thomas,

    The UnboundCheckBoxColumn for the WebDataGrid is not implemented using a checkBox control for each row so there is no object to be accessed and disabled.

    I have created a sample for you using the Northwind DB which demonstrates how your requirement could be achieved. The sample employs client side functions in order to "disable" changing the state of even indexed rows.

        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";
            }
        }

    And the client-side code:

        <script type="text/javascript" id="igClientScript">
    <!--

    function WebDataGrid1_Grid_HeaderCheckBoxClicked(sender, eventArgs)
    {

        for (i = 0; i < $find('WebDataGrid1').get_rows().get_length(); i++) {
            if ($find('WebDataGrid1').get_rows().get_row(i).get_tag() == true) {
                $find('WebDataGrid1').get_rows().get_row(i).get_cell(3)._setCheckState(false);
            }
        }
       
    }


    function WebDataGrid1_Editing_CellValueChanging(sender, eventArgs)
    {

        if (eventArgs.get_cell().get_row().get_tag() == true) {
            eventArgs.set_cancel(true);
        }
       
    }



    // -->
    </script>

    Please tell me if this helps.

    Best Regards,

    Petar Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://ko.infragistics.com/support

    WebDataGridDisableSomeCheckBoxes.zip
Children