Wednesday, March 21, 2012

Problem in using validation in Multiple step Wizard in content place holder of master page

We have a master page with many content place holders. All placed in ATLAS update panel.

In Content page we are using wizard control and we want to do validation on each step of wizard. Problem is that one 1st step is successfully validated and user moves to 2nd step of wizard and after entering data clicks next button. Validation controls used in 1st steps are invoked and causes error.

Master Page

,,,,,,,

<atlas:UpdatePanelID="AP1"runat="server">

<ContentTemplate>

<

asp:ContentPlaceHolder> < /asp:ContentPlaceHolder>

</

ContentTemplate>

</atlas:UpdatePanel>

------------------

Content page

<

asp:Content runat="Server">

<

atlas:UpdatePanel > <ContentTemplate>

<

asp:Wizard >

<

WizardSteps>

<

asp:WizardStepStepType="start">

<

asp:TextBoxID="TxBx_Extension"runat="server"ValidationGroup="Step1"></asp:TextBox> <asp:RequiredFieldValidatorID="RFV_Extension"runat="server"Display="None" ControlToValidate="TxBx_Extension"ValidationGroup="Step1"ErrorMessage="Extension Required!"> </asp:RequiredFieldValidator> <asp:ValidationSummaryID="VS_Step1"ShowMessageBox="true" ShowSummary="false"runat="server"ValidationGroup="Step1"/>

</

asp:WizardStep>

</WizardSteps>

</asp:Wizard >

</ContentTemplate>

</atlas:UpdatePanel >

</asp:Content>

Hello, hey guys and guls listen i have found a bug in asp.net but i want to tell u people and check it if u really a true lover of .net so here u goes ...

No one replied to this message query and it took almost three days to debug so i have happy to find the reason but i want every to atleast read this so he may not get struck while when he or she is coding his or her program.

Try to make a master page and then add a content page now creat contentplaceholder in master page and write ajax or atlas script manager and updatepanel in master page and go to content page make a multi step wizard and try to includ validation in step (start) and then try not to use any validation control in the next (step/final)step, this page is going to give error and if u dont use any validation control in this step and suppose i dotn't need any validation in this step but i have to use it because else i can't proceed in the next step of my step by step program, why should i have to use validation control in next step when i dont need it.

Thanx for considering this too ;)... enjoy and don't worry because this happen when there are new things to discover ...... :D.


hello.

i'm sorry, but i didn't get it...can you build a demo project and send it to me?

thanks.


Luis Abreu:

hello.

i'm sorry, but i didn't get it...can you build a demo project and send it to me?

thanks.

I'm afraid I don't get it, either. I have a multi-step Wizard with validators on every page save the last one, in a Master Page setup, with an UpdatePanel around the content placeholder.


Err, sorry, I forgot to mention my setup works without a hitch.

ashfaqcool, can you give us a short and complete example of the issue you're running in to? The code for the master page and the content page would greatly help.


hello sir,

As u said that u have validators in each step of the wizard try to remove a validation in intermediate step e.g u have validation controls on first step and then on 2nd step i dont need any of the validation control then u want to proceed to last step then u will recieve an error when u press next on the 2nd step.

thanx for looking into this and i hope u got it.


here is the demo

make a master page with name MasterPage.master and past this code ...

MasterPage.master

-----------------------------------------------

<%@. Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>

<form id="form1" runat="server">

<atlas:ScriptManager ID="Script_manager" EnablePartialRendering=true runat="server"> </atlas:ScriptManager>

<div>
<atlas:UpdatePanel runat="server" ID="UpdatePanel_1">
<ContentTemplate>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
<asp:contentplaceholder id="ContentPlaceHolder2" runat="server">
</asp:contentplaceholder>
</ContentTemplate>
</atlas:UpdatePanel>
</div>
</form>
</body>
</html>

-------------------------------------------

now make a content page with name default.aspx and paste the following code into it.

Default.aspx

-------------------------------------------

<%@. Page Language="VB" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<asp:Wizard ID="Wizard_1" Width="50%" runat="server" DisplaySideBar="False">
<WizardSteps>
<asp:WizardStep ID="Step_1" StepType="Start" runat="server" >
Enter Name: <asp:TextBox ID="TxBx_1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="TxBx_1" ID="RFV_1" runat="server" Display="None" ErrorMessage="Name Required!" />

</asp:WizardStep>

<asp:WizardStep ID="Step_2" StepType="Step" runat="server" >
Enter Password: <asp:TextBox ID="TxBx_2" runat="server"></asp:TextBox>

<%--<asp:RequiredFieldValidator ControlToValidate="TxBx_2" ID="RequiredFieldValidator1" runat="server" Display="None" ErrorMessage="Password Required!" /> --%>


</asp:WizardStep>

<asp:WizardStep ID="Step_3" StepType="finish" runat="server" >
<asp:TextBox ID="TxBx_3" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="TxBx_3" ID="RFV_3" runat="server" Display="None" ErrorMessage="Text Required!" />
</asp:WizardStep>

</WizardSteps>
</asp:Wizard>
<asp:ValidationSummary ID="VS_2" DisplayMode=BulletList ShowSummary=false runat="server" ShowMessageBox=true />

</asp:Content>
----------------------------------------------
now if u want to remove to remove or u want to debug just enable the validator written in colourful line

(green colour) in the default.aspx code

thanx i think and hope that, that solves the confusion; thanx.


I tried your code and I'm not getting the behavior you described. I uncommented the second step's validator and everything works as it should: step one's validator works as it should and so do the others. With the second step's validator commented, the page still works as it should and the behavior you describe doesn't manifest itself.

What version of ASP.NET AJAX are you running? I am running Beta 2.


i am having ASP.NET ATLAS. so u having ASP.NET AJAX beta 2.0 i think u are running the latest version.so i will try the same version ok thanx.

No comments:

Post a Comment