Using MultiView and View WebControls

In this example we will build a sign up process using the MultiView and View WebControls, using a single ValidationSummary across all the View’s.

The first step (or view) of the sign-up process will only ask for one item of information, letting the user to believe this will be a quick sign up process, then the next step (or view) will ask for three more items, followed by a third step which request one final more item, before the fourth step displays a thank you message.


        

Newsletter

Email: Name: Telephone: Company: Please select the categories you would like to read about: Thank you

You will notice that the ValidationSummary is not in the MultiView, the ValidationSummary will automatically validate the validation controls that are being shown by the currently active View.


namespace MultiViewAndViewWebControlTestApp
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BtnRegister.Command += Newsletter_Commands;
            BtnContactDetails.Command += Newsletter_Commands;
            BtnFinish.Click += BtnFinish_Click;
        }

        private void BtnFinish_Click(object sender, EventArgs e)
        {
            if (!IsValid)
                return;

            mvNewsletter.ActiveViewIndex++;

            //register all the data
        }

        private void Newsletter_Commands(object sender, CommandEventArgs e)
        {
            if (!IsValid)
                return;

            mvNewsletter.ActiveViewIndex++;
        }
    }
}

In this example we use both the Button Command and Click Events to handle moving from step to step and them processing the data.

You can download the Using MultiView and View WebControls project here



Comments

No comments yet.

Add Yours

  • Author Avatar

    YOU


Comment Arrow




About Author

Robert

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning hands down.