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
190
UltraWebGrid and Checkboxes
posted

I have an UltraWebGrid that is bound to a sql data source through the code behind. I have also added a check box column through the code behind but don't know how to set the checked property based on a value of another column in the same row.

Any Ideas?

My sample would by a column called "First" which has a value of true or false. If the value on a particular row is true, then the checkbox on that row needs to be checked.

Thanks for the help!

Parents
  • 19693
    posted

    Hello mnmjones,

    I recommend you using InitializeRow for the purpose.

    In my scenario I have 2 columns:

    1) ProductID - int value , depending on it I will change the checkbox state

    2) Discontinued -boolean , the checkbox column

       protected void UltraWebGrid1_InitializeRow(object sender,   Infragistics.WebUI.UltraWebGrid.RowEventArgs e)

        {

            int cellValue = (int)e.Row.Cells.FromKey("ProductID").Value;

            if (cellValue % 2 == 0)

            {

                e.Row.Cells.FromKey("Discontinued").Value = true;

            }

            else {

                e.Row.Cells.FromKey("Discontinued").Value = false;

            }

        }

    Please let me know if you need further assistance regarding this.

Reply Children