This is a migrated thread and some comments may be shown as answers.

Setting a value to a GridClientSelectColumn

4 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chris
Top achievements
Rank 1
chris asked on 03 Jan 2009, 05:03 AM
I have a grid where the last column is a GridClientSelectColumn which is going to be used as multi delete function so the user does not have to click delete over and over. I have looked around but i can not seem to figure out how to set the value of the check box as the id number (AdminGroupsId) and then retrieve it when i post it.

Thank you for your help

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 05 Jan 2009, 06:04 AM
Hi Chris,

You can access the Selected rows in the Click event of the Delete button and Once you get the selected rows you can perform the Delete operation.

CS:
  protected void LinkButton1_Click(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.SelectedItems) 
        {  
         //Perform the Delete operation 
        } 
    } 


Shinu
0
chris
Top achievements
Rank 1
answered on 05 Jan 2009, 01:48 PM
Thanks for your example code but what is it passing? I do not see where i can set that the check box value is AdminGroupsId?


0
chris
Top achievements
Rank 1
answered on 06 Jan 2009, 02:56 AM
I have found it. Thanks for your help. If anyone is searching for the full answer here it is for the value of AdminGroupsId

in your MasterTableView put DataKeyNames= "AdminGroupsId"

as shinu said on your button click put the following

 foreach (GridDataItem item in RadGrid1.SelectedItems)
            {
                string AdminGroupsId = item.OwnerTableView.DataKeyValues[item.ItemIndex]["AdminGroupsId"]
                //Perform the Delete operation with id 
            }

Thanks again for your help
0
Accepted
Shinu
Top achievements
Rank 2
answered on 06 Jan 2009, 04:47 AM
Hi Chris,

You can access the DataKeyValue of the Selected rows in the following way also.

CS:
 foreach (GridDataItem item in RadGrid1.SelectedItems) 
        { 
            string strAdminGroupsId = item.GetDataKeyValue("AdminGroupsId").ToString(); 
        } 


Regards
Shinu
Tags
Grid
Asked by
chris
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
chris
Top achievements
Rank 1
Share this question
or