Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

When you gotta go,you gotta go !!!!!!!
Posted
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?

Posted
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)

When you gotta go,you gotta go !!!!!!!
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...