Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web User Controls not working well together....

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I'm making use of a number of web user controls in a web page.
I'm making use of Visual Studio (with C# code)

The first of these has a simple MultiView control in it with 2 View's.

The second has a series of ASPxButtons - sharing the same GroupName - so that only one can be checked at a time.
For each ASPxButton there is an associated 'div' which contains a LiteralControl (displaying a FusionChart).
The appropriate 'div' is displayed according to the following code:

<ClientSideEvents CheckedChanged="function(s, e) {
if (s.GetChecked())
{
divSurgeryUsage.style.display = 'block';
}
else
{
divSurgeryUsage.style.display = 'none';
}
}" />

... so only one div (and corresponding LiteralControl is shown at any one time.
This control works ok in it's own right.
But I've now introduced it into a page with my first control (containing the simple MultiView).

When I move between View's in the MultiView control in this first control - the second control then behaves oddly - and the displayed LiteralControl (in the appropriate 'div') is no longer seen. It is only shown again by re-clicking the buttons in the second control.

How can I have these controls work together - so that the first makes use of the MultiView and the second makes use of the ClientSideEvents as detailed above?
Any help / pointers would be appreciated.

Thanks in advance,
Steve
 
If your multiview is causing a postback, and you set the visibility of other controls with javascript, you have to set the visibility again after postback.
The state of your other controls is not saved in viewstate if it is set through javascript.
 
Thanks. I'd assumed the PostBack was causing the issue here.
Given this fact - is there any way I can bypass this problem - and have the second user control recall which 'div' was being shown at the time (the MultiView control was altered) and reset this accordingly?

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top