hiding groups of data elements on a webform?

M

MDB

This may sound like a naive question, but that's only because I'm naive
about most things ASP.NET, as my background is primarily Lotus Notes
Development, and before that, DOS-based FoxPro.

Is there a way to group elements, such as a set of textboxes and related
labels, in effect giving them a common group name that could then be used to
disable/enable other elements on the page? For example if I have a
_textChanged event on a textbox that detects an error, it would be lovely to
be able to hide all the other controls on the page, to reinforce the notion
that the user really can't do anything until they fix the error in the
original textbox. I've dealt too often with users who need to be hit over
the head with a sledgehammer like that.

Right now, I see my choices as: 1) putting the controls to be hidden in a
panel and hiding the panel, which is not an ideal solution because it would
involved redesigning the screen; or 2) immediately redirect the user out of
the edit screen back to the main screen, and display a bright red error msg
in my lblErrMsg label telling them what they just did wrong. Both accomplish
the goal of keeping the user from doing anything else on the edit screen,
but only one stays on the edit screen and lets the user correct their
mistake on the spot, rather than starting all over again. Only the spectre
of undoing my work on the editscreen to put fields on a panel is keeping me
from embracing that option.

I'm also open to any and all suggestions, if the answer to my original
question is 'so sorry'. Thanks!

MDBloemker
(e-mail address removed)
 
N

Natty Gur

Hi,

1) I dont think that hidding control is a good idea from the user point
of view, consider disable control instead of hidding them.

2) for the same resson using panel (<DIV>) to group control is better
idea then redirecting your user to page with description what he is
doing wrong but with no option to fix his mistake. stay in the same page
where error happned, disable all nesesery buttons, display error details
and let your user fix them.

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
M

MDB

I've already been informed by the user that redirecting is out of the
question; if there's an error, they want to correct it immediately.
Disabling all other controls on the page except for the textbox that needs
to be corrected is the way I need to go, but the question remains, does
there exist any other approach to this other than coding each individual as
disabled( Textbox1.enabled = false, DropDown2.enabled = false, 97 lines of
code altogether for 97 controls) in the error event, and then turning
churning through 97 controls to enable them after the error is resolved? I
dimly remember FoxPro having the ability to assign a single group name to
selected controls, towit, say, these five fields and/or dropdowns have the
same group name Group1, so the command to enable or disable or hide only
those particular fields would be along the lines of Group1.enabled = false
(yes, I know that's not FoxPro syntax, but it's been so long since I've
coded in FP that I'm approximating.

(If that functionality doesn't exists in ASP.NET right now, how best might
one go about suggesting it as a future enhancement???)

MDBloemker
(e-mail address removed)
 
N

Natty Gur

Hi,

You can just disable buttons (to prevent user from redirecting to other
page or perform any action until all fields with errors changed by
user). you can place buttons on panel and disable the container panel. I
dont familiar with any way to disable groups of control without using
containers.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top