Dynamically Enable/Disable Controls Inside FormView

  • Thread starter Thread starter Ryan
  • Start date Start date
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!
 
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
 
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,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

My vacation and childhood cancer awareness site:
http://www.crazycancertour.com

*******************************************
| Think outside the box! |
*******************************************
 
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?
 
Back
Top