Solved

Add a Role to a user in ASP.NET web Form

Posted on 2009-07-13
2
260 Views
Last Modified: 2012-05-07
Hello,
I have on a ASP.NET web form, 1 Grid views
userGV and one List box roleLB
After bounding both of them into membership data,
i want on a button click event to add the role selected in the listbox to the user selected in the grid view.
so i wrote :
 Roles.AddUsersToRole(userGV.SelectedValue, RoleLB.SelectedValue)

and i got this error :
Unable to cast object of type 'System.String' to type 'System.String[]'.

How can i achieve this,
and how can i tell the user who is adding the ROles, for instance that a Role has already been assigned to the following user
thanks
i am using VB
0
Comment
Question by:Nyana22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
wht1986 earned 450 total points
ID: 24845940
is only adding a single user to a single role, use "Roles.AddUserToRole" not the plural users of "Roles.AddUsersToRole"
0
 
LVL 9

Assisted Solution

by:Rahul Goel ITIL
Rahul Goel ITIL earned 50 total points
ID: 24846647
It seems that you have selected multiple rows in datagrid or multiple items in list of roles

you can refere to the grdView.SelectedRow and get the specific value and convert it to string
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question