tags:

views:

30

answers:

1

Hi,

I have a page with a gridview that is populated from a sql. The table on the sql is setup as follows.

sopid, Type, DisplayOrder, Deleted.
1 test1 1 False
2 test2 2 False

What i want to do is have a checkbox on the left hand side of the grid where if i check test1 and test2 for example it outputs the sopID to a textbox in the following manor - 1,2 etc... Also if i untick one it removes it from the textbox as well.

Thanks

A: 

try this one

List list = new List(); for (int i = 0; i < GridView1.Rows.Count; i++) {

        CheckBox ch = GridView1.Rows[i].FindControl("urCheck") as CheckBox;
        if (ch.Checked == true)
        {
            list.Add(GridView1.DataKeys[i].Value.ToString());
        }


    }

access the string list and do the functionality as you needed.

Maxymus
Thansk Perfect, thank you.
Steve