473,789 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiview and viewstate

I noticed something interesting when using the Multiview control and was
wondering if someone could shed some light on the inner workings of all
of this so I can better understand what's going on here.

Basically I'm using the Multiview as a kind of wizard with back/next
buttons. At step one, I ask a question... let's say "How old are
you?"... and I use the response to this question to determine the
contents of the controls on subsequent steps of the multiview.

To keep things simple, let's imagine that step has a label that says "A
year ago you were x years old" and step 3 in my little wizard has an
equally useless label that says "Next year you'll be y" where x = age -
1 and y = age + 1...

Now, when I'm writing code in the "Next" button in the view for step 1,
I first change the active view in my multiview control, then I inspect
the value of the ageTexEdit.Text control and use this to set the text
for steps 2 and 3 of the wizard... something like:

// Set active view
myMultiView.Set ActiveView(step 2View);

// Read in response to step one and update steps 2 and 3 accordingly
int age = int.Parse(ageTe xEdit.Text);
step2Label.Text = String.Format(" A year ago you were {0} years old",
age - 1);
step3Label.Text = String.Format(" Next year you'll be {0}", age + 1);
Also, presume that before any of the code above has executed the
properties for step2Label.Text and step3Label.Text are "step 2" and
"step 3" resepectively.

Now, if I now fire up my wizard and enter my age as "10" and click on
the next button, in step 2 everything looks as it should... it says "A
year ago you were 9 years old". However, when I click on the "Next"
button in step 2 of the wizard, which simply does the following:

myMultiView.Set ActiveView(step 3View);

The text in step three still says "step 3"... so the code that was run
successfully in the On Click event handler for the next button in step
one DIDN'T do what I was expecting. It set the value of step3Label.Text
correctly, however this value did NOT get stored in the viewstate for
the form.

Can anyone explain to me why this is the case?

By the way, it's easy enough to work around this by setting the text for
step2Label and step3Label in the ActiveViewChang ed event of the
multiview when the view that each control is contained in becomes
visible/active. So I'm not looking for a "workaround " to this - that's
very simple. I'm simply looking to better understand the mechanics of
all this and understand why the actual behavior is not what I was expecting.

TIA.

Best Regards,

James Crosswell
Microforge.net LLC
http://www.microforge.net
Dec 11 '07 #1
0 1565

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1806
by: Fabuloussites | last post by:
I have a page that has multiview control that has two dropdown lists on it. the dropdown controls ARE NOT inside of the multiview. Each drop down is bound using its own sqldatasource conrtol. The multiview is declared below the dropdown controls on another portion of the page. so, here is the progression.. 1) select a category from drowdown one that is bound using sqldatasource1 2) dropdown2 is populated based on selection or...
0
1806
by: eric.olstad | last post by:
I want to create a web site that can dynamically creates tabs -- like firefox functionality built into a web site. Take a look at this site to get an idea of what I'm looking to do: http://www.krugle.com/demos/Overview5_800.html Now, I'm not looking to copy the entire interface from Krugle, but I am very interested to understand how they are implementing those tabbed panes. It's pretty brilliant because they're dynamic.
4
3280
by: TMT32 | last post by:
Hi, I try to add multiview in datalist, but how to change multiview's default view page in datalist? Where it is ? datalist1.itemtemplates.itemtemplates.multiview ?? thanks TMT32
2
2674
by: Alexander van Doormalen | last post by:
I have a MultiView control with 2 Views in it. In the first View I have a form which contains sereral input controls and a custom UserControl. In this custom UserControl I have a button which causes a postback. When the click event gets handled I am grabbing the MultiView instance from a parent control (using a recusive method). When i change the active View on this MultiView control nothing happens. The second time you click the button...
1
2132
by: nospam | last post by:
I have a MultiView with two views in it. View1 has a GridView and a SqlDataSource. View2 has a few link buttons that set the SelectCommand for the SqlDataSource to show a few reports. Here's the extremely basic code sample: Protected Sub btnAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAll.Click SqlDataSource1.SelectCommand = "SELECT * FROM dbo.ONT_LDAP_LOG" MultiView1.SetActiveView(View1) End Sub
0
2400
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile View I want the form populated from there profile on the sql server. The code to save the profile works fine. But when the user logs back in they data doesn't load back to the form. The multiview is located inside the LoginView's Logged-In View ....
1
4118
by: Nathan Sokalski | last post by:
When I include a MultiView control in my application, I receive the following error: MultiView cannot have children of type 'Label'. It can only have children of type View. I receive the same error (with 'Label' replaced with another control type) when I use other control types as well. The only type of control that is an immediate child of my MultiView control is View. The basic layout of my MultiView control is:
4
2117
by: DC | last post by:
Hi, the subject says it all. Since visible=false controls will still run though Page_Load, I was hoping that the MultiView would somehow manage to avoid a Page_Load of controls in its inactive Views. But of course it does not. I guess a safe way to avoid Page_Load is to only add the controls at runtime into the activated view. Which of course neglects the beauty of editing the layout if several views in one ascx.
0
3123
by: wfsmith | last post by:
I have a page with a MultiView control and 6 Views. Each view has a User control that contains various form controls (dropdowns, textboxes and CascadingDropDown Ajax.Net controls). When the page is loaded, I populate the various form controls with data inside each of the 6 Views by accessing my exposed properties of my User Control. All the controls persist during postback, and any changes I make also persist during postbacks, but...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.