Rattlesnake Posted August 29, 2005 Posted August 29, 2005 Hi, I have a ASP.net application that has a webform that contains a Dropdownlist (webcontrol). Lets say the dropdownlist has the values 1,2,3,4 (These values are retrieved from a Database. ) I have 2 types of users accessing the application - "Normal Users" and "Admins". Both can be accessing and updating same records. What I want is that , in the dropdownlist the "Normal Users" should only be able to select 1 or 2 from the dropdownlist. Whereas the Admins should be able to select any of the values. But the "Normal Users" should be able to SEE 3 or 4 , if it was previously selected by an Admin user. Does anyone know how I can implement this? Thanks Quote When you gotta go,you gotta go !!!!!!!
samsmithnz Posted August 29, 2005 Posted August 29, 2005 Hi, I have a ASP.net application that has a webform that contains a Dropdownlist (webcontrol). Lets say the dropdownlist has the values 1,2,3,4 (These values are retrieved from a Database. ) I have 2 types of users accessing the application - "Normal Users" and "Admins". Both can be accessing and updating same records. What I want is that , in the dropdownlist the "Normal Users" should only be able to select 1 or 2 from the dropdownlist. Whereas the Admins should be able to select any of the values. But the "Normal Users" should be able to SEE 3 or 4 , if it was previously selected by an Admin user. Does anyone know how I can implement this? Thanks If it's set to 3 or 4, can the normal user change it? Quote Thanks Sam http://www.samsmith.co.nz
Rattlesnake Posted August 29, 2005 Author Posted August 29, 2005 If it's set to 3 or 4, can the normal user change it? No, he should not be able to change it. He should only be able to view it (if it's set to 3 or 4) Quote When you gotta go,you gotta go !!!!!!!
samsmithnz Posted August 29, 2005 Posted August 29, 2005 you could just disable the control... or I use this function to remove all values, but the selected value. Then you can enter in the item for the user, but they won't be able to change it. I use this, because I don't like the way a disabled control is so had to read (because it's greyed out) 'This function is designed to replace the .enabled function, by removing all but the selected item from the list. 'The reasoning behind this function is to make the combo look better, and not have the text grayed out. Friend Function DisableComboBox(ByVal objCombo As System.Web.UI.WebControls.DropDownList) As Boolean Dim objItem As ListItem objItem = objCombo.SelectedItem objCombo.Items.Clear() objCombo.Items.Add(objItem) End Function Quote Thanks Sam http://www.samsmith.co.nz
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.