开发者

How to disable page validation when clicking previous in a wizardstep

When I try to click the previous button in a wizard step on my page, it wont return to the previous page until all o开发者_StackOverflowf the fields are valid. I have turned of CausesValidation. Is there an issue with this in a wizard? My code follows:

<StepNavigationTemplate>
        <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
            Text="Previous" OnClientClick="DisableButton(this);" UseSubmitBehavior="False"
            CssClass="bigButton" />

Cheers


You should look at the following question asked on SO. This explains how you can disable the validation in steps. You basically will have to take care of it in the code.


For all your validator controls in the asp page set them to enabled=false. Then in your code behind for the next button click or whatever button you want the validators to work, set the validators to enabled=true.

asp.net:

< asp:RequiredFieldValidator Enabled="False" ID="TitleRequiredFieldValidator" runat="server" ControlToValidate="TitleTextBox" ErrorMessage="Title is Required." ToolTip="title is required" ForeColor="Red">*< /asp:RequiredFieldValidator>

vb:

Protected Sub CreationWizard_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles CreationWizard.NextButtonClick
    If (CreationWizard.ActiveStepIndex = CreationWizard.WizardSteps.IndexOf(Me.WizardStep1)) Then
        TitleRequiredFieldValidator.Enabled = True

    End If
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜