I have a dropdownlist which contains selections of groups i.e. group1, group2, group3 etc. For example, a user named Alex logs in and his group is group2, so he will only be allowed to select "group2" from the dropdownlist (to view the group details) and not the other groups. Is it possible to accomplish this using visual studio 2010? If so please explain in full detail as I am a beginner.
-
you maintaining any roles concept? – Deepak Saralaya Dec 31 '13 at 06:47
-
Simple, based on the user bind the dropdownlist. – Naveen Dec 31 '13 at 06:49
-
Check Below Link.It Might Helps you http://stackoverflow.com/questions/1379125/make-drop-down-list-item-unselectable – Manoj Kumar Yellapragada Dec 31 '13 at 07:07
2 Answers
Here is a link on how to create a web site project with membership and user log in with asp.net webforms.
http://msdn.microsoft.com/en-us/library/879kf95c(v=vs.100).aspx
Once you have created a site you can create groups like in you example.
After a user logs in in the on click event handler for your drop down list you can check to see if they have the required group membership using calls to the membership providers API.
Hear is link that hows how to create and manage user groups or "roles" as the document calls them.
http://msdn.microsoft.com/en-us/library/t32yf0a9(v=vs.100).aspx
Once you have users and groups set up and your user is authenticated it's a simple matter of checking if they are in a group.
Hear is a quick explanation and a bit of example code on how to check the users role membership once they are authenticated.
asp.net membership - how to determine programatically is user is in role
There is quite a bit of work to get through to get this up and running in webforms if your able to use asp.net mvc then the project template has it backed in. But that will make your drop down list code far more complicated.
in page load you set other dropdownlists disable like DropDownList1.Enabled = false;
- 5
- 2