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

ASP.NET Memebership Operations from RadGrid

1 Answer 17 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcio Nascimento
Top achievements
Rank 1
Marcio Nascimento asked on 06 Aug 2012, 06:57 PM
Hi Folks!

I really need some help here. I start a small project to enable all ASP.NET Membership Operations from a RadGrid such as: add user, delete and update, including managing their respective Roles from a RadGrid. Please follow my code: MembershipTest 

Until now, my project includes:
  • Update (Working)
  • Edit (Working, but not capturing cheboxes previous values)
  • Delete (Not Working, I don't know why!!)
  • Add (to be Implemented...)

Issues:
  1. I do really need some help to discover why "Delete User" is not working.
  2. When I edit user, those checkboxes do not fill with previous values. I look up Radgrid documentation but I can't figure out how to do this.
  3. Someone have an idea on how to implement "Add User" Operation? It is possible to show a form in Radgrid adding the password field? 

I appreciate any help.

Regards,

Marcio Nascimento

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 09 Aug 2012, 11:52 AM
Hello Marcio,

Try running the project in debug mode and you will notice that it hits errors during delete and edit.

Note that the GridClientDeleteColumn only hides the records and marks them for deletion but does not actually delete them until the next postback. When it happens, you get an exception because the username property is not populated anywhere in code. To fix this, try the following code:
protected void RadGrid1_DeleteCommand(object sender, GridCommandEventArgs e)
{
    GridDataItem item = e.Item as GridDataItem;
    Membership.DeleteUser(item["UserName"].Text);
}

As for insert, you can specify a FormTemplate which declares a textbox in password mode for specifying the password.

Kind regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Marcio Nascimento
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or