Dynamically Enable/Disable Controls Inside FormView

R

Ryan

Good Morning All,

I have a question. I'm converting an old VB6 app to web app. I'm
using a formview to perform editing/inserting functions. Based on a
user's access and certain details of the record, the user will be able
to perform certain functions (i.e, update this field, click this
button, etc). I'm familiar with using the FormView.FindControl method
however, I was hoping for an easier method. I'm really "green" when
it comes to ASP.net but my question is is there a way to enable/
disable certain controls through the use of themes/styles/css?

Cheers!
 
R

Ryan

What difficulties are you actually having...?

I'm not exactly sure which direction to go down. I'm not really
familar with styles or themes. I'm familar with CSS but how do I tie
that into the controls inside the formview. I'm hoping for an easier
way using stylesheets rather than manually change a textbox or
dropdownlist enable property to false based on conditions. Is there
way I can say use this style class or theme? If so, how? Its my
first time using the FormView.

Cheers
 
G

Gregory A. Beamer

Good Morning All,

I have a question. I'm converting an old VB6 app to web app. I'm
using a formview to perform editing/inserting functions. Based on a
user's access and certain details of the record, the user will be able
to perform certain functions (i.e, update this field, click this
button, etc). I'm familiar with using the FormView.FindControl method
however, I was hoping for an easier method. I'm really "green" when
it comes to ASP.net but my question is is there a way to enable/
disable certain controls through the use of themes/styles/css?

Yes and no.

There are things you can do, but with rule #1 being "never trust user
input", you still end up setting things on the backend to ensure someone
does not figure a way around your forms.

This is perhaps less important with internal apps, but it is still an
issue, as employees are often the most destructive to data.

My preference would be to enable/disable or show/hide (visible=true)
controls in the code based on user access. This keeps the application in
the libs, where it belongs, and makes the UI truly a UI. Yes, it is more
of a pain, but it is a one-time exercise per form.

Peace and Grace,
 
R

Ryan

I'd leave well alone...

Styles and themes are great for displaying how things look, but CSS really
isn't a programming language...

So I suppose an idea would be to place the controls inside a panel and
just disable/enable the panel. The should propagate down to the child
controls right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top