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
769
How to retrieve (get) the checkbox state value from a list of rows in ultrawebgrid
posted

Hi all,

 I have a couple of questions in regards to how to retrieve (get) the checkbox state value.

1. I have a an ultrawebgrid with three columns, col1 = Customer ID, col2 = Customer Name, col3=checkbox. (When the checkbox is clicked, it will determine wether an email will be sent out to this customer or not). The checkbox that I used is the one that comes with the webgrid. So all I did was create my column and set the Type="checkbox"

My webgrid has many rows and so from the webgrid and I would like to click on the check box for some customers (records) and not for some. Then I click the Save button to save (update the database) all of the records that have been checked.  So on the code behind, how do I determine the value of the Customer ID, Customer Name and the checkboxes that have been selected on the Save button event? My Save button is a regular asp:Button (asp.net 2.0).

2. Would it be better to use an asp:checkbox and embedded inside the ultrawebgrid TemplateColumn?

Please let me know if option one is better or option two is better. Please provide some code sample if possible.

Thanks in advance!

hs2

Parents
No Data
Reply
  • 295
    posted

    Use the following code to get the checked columns:

     foreach (UltraGridRow row in Grid.Rows)

                {
                    if (row.Cells[columnIndex].Value.ToString().Equals("True"))
                    {
                        // CheckBox is checked
                    }

                   else

                    {

                        // CheckBox is not checked.

                    }
                }

Children