473,322 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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.SetActiveView(step2View);

// Read in response to step one and update steps 2 and 3 accordingly
int age = int.Parse(ageTexEdit.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.SetActiveView(step3View);

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 ActiveViewChanged 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 1531

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

Similar topics

0
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...
0
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:...
4
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
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...
1
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...
0
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...
1
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...
4
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...
0
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.