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

Delete with contextMenu on a hierarchy radGri

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 09 Jun 2011, 04:52 PM
Hi guy,

I have a little problem. I'm using a hierarchy grid. The "parent" grid show the roles in my table aspnet_Roles. The nested grid show the user related to the role. For populating my grid, I'm using a dataSet. My problem is that I don't know how to delete the relation between a user and a role using a context menu. I tried the seconde example on this page, but I still have some problems. In fact, this is how I do :

string[] args = Request.Form["radGridClickedRowIndex"].Split('_');
int indice = Convert.ToInt32(args[args.Length - 1]);
string UId = Request.Form["radGridClickedTableId"];
 
GridTableView tableView;
 
tableView = this.Page.FindControl(UId) as GridTableView;
string userName = ((tableView as GridTableView).Items[indice] as GridDataItem)["UserName"].Text;
string roleName = ((tableView as GridTableView).Items[indice] as GridDataItem)["RoleName"].Text;
 
Roles.RemoveUserFromRole(userName, roleName);
 
tableView.Rebind();


When I tried it, this message appears :  Cannot find a cell bound to column name 'RoleName'

The only way I find to correct this problem is to add the column RoleName to the nested grid, but I don't really like showing the name of the role for each user. So, is it possible to find to which row the nested grid is related and access his data (in my case, RoleName). 

Thank you,
David Lefaivre-B.

1 Answer, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 09 Jun 2011, 07:07 PM
Hi again,

Finally I find the solution. I just set visible="false" for the RoleName column and everything was solved.

Sorry for the incovenience
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Share this question
or