Hiding and showing panel in client side in aspnet

W

wandali

Hello,

I have a problem in finding the status of a panel (visible or not). I
have a dropdownlist that associates with a panel in which textbox are
embeded in the panel. A client side VBScript is run when the value of
the dropdown change. And here is the script


if document.all(dropdown).value ="-1" then
document.all(panel).style.display = "block"
else
document.all(panel).style.display = "none"
end if

When I do validation at ther server, how do I know if the panel is
visible or not?

Panel.visible is always true, Panel.style("Display") is always = ""

I don't want to make the panel visible from the server side, as the
AutoPostBack is really annoying, but I have to do a lot of validation
at the server, is there any suggestion in my approach or how can I get
around that, am I doing something wrong?

Thanks in advance.
Wanda
 
C

Craig Deelsnyder

Hello,

I have a problem in finding the status of a panel (visible or not). I
have a dropdownlist that associates with a panel in which textbox are
embeded in the panel. A client side VBScript is run when the value of
the dropdown change. And here is the script


if document.all(dropdown).value ="-1" then
document.all(panel).style.display = "block"
else
document.all(panel).style.display = "none"
end if

When I do validation at ther server, how do I know if the panel is
visible or not?

Panel.visible is always true, Panel.style("Display") is always = ""

I don't want to make the panel visible from the server side, as the
AutoPostBack is really annoying, but I have to do a lot of validation
at the server, is there any suggestion in my approach or how can I get
around that, am I doing something wrong?

Thanks in advance.
Wanda

Try accessing it's style info via the Style property to see if it was
hidden:

http://msdn.microsoft.com/library/d...webuiwebcontrolswebcontrolclassstyletopic.asp

The problem is that on the client-side the viewstate string already says
the panel was visible, and that is a 'static' hidden field. So you have
to know it is 'incorrect'....
 
K

Kevin Spencer

On the server, the display style of the div will not be available. Only
posted form data. However, if you can write a JavaScript function that hides
the div, you can certainly write JavaScript that populates a hidden form
field. ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
W

Wanda Li

Is there a way I can retrieve the status (visibility) of a server side
panel? If I do it thru' javascript, how can I get the answer from my
aspnet page (server side)

Thanks
Wanda
 
K

Kevin Spencer

From the hidden form field!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
W

Wanda Li

Here is what I am working on, I have to check if a textbox is filled or
not. If it is visible, then it must be filled. That's why I need to know
the status (visiblilty) of the panel (in which the textbox embeded in
it). Or is there any workaround?

Thanks
Wanda
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top