سؤال

I have createuserwizard control which has 4 steps. When some parameters exists in qeurystring, I want to set them for contols in step 0 and then set activeindex to next step. I do it like this:

 if (!Page.IsPostBack)
        {
            if (!String.IsNullOrEmpty(Request["from"]) && !String.IsNullOrEmpty(Request["to"]) && !String.IsNullOrEmpty(Request["seek"]) && !String.IsNullOrEmpty(Request["livein"]))
            {
                ((DropDownList)RegisterUser.WizardSteps[0].FindControl("ddlGender")).SelectedValue = Request["seek"];
                ((TextBox)RegisterUser.WizardSteps[0].FindControl("txtAgeFrom")).Text = Request["from"];
                ((TextBox)RegisterUser.WizardSteps[0].FindControl("txtAgeTo")).Text = Request["to"];
                ((DropDownList)RegisterUser.WizardSteps[0].FindControl("ddlLive")).SelectedValue = Request["livein"];

                RegisterUser.ActiveStepIndex = 1;
            }
        }

This works and set current step to correct step but the problem is "Previous" button does not work and it does not go to step 0.

هل كانت مفيدة؟

المحلول

When the Previous button is clicked on the Wizzard control in ASP.NET there are two events which fire, in this order:

1) PreviousButtonClick

2) ActiveStepChanged

My suggestion is - put break points in these two events and make sure both are executed when you click Previous.

Additionally, if you have any code inside the two event handlers which I've just mentioned make sure that they do not reset the ActiveStepIndex

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top