Showing posts with label wizard. Show all posts
Showing posts with label wizard. Show all posts

Saturday, March 24, 2012

Wizard and text/xml-script question

I am using a wizard control.

At the bottom of the page I have this:

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>
<control id="divSample" visibilityMode="Collapse"/>
</components>
</page>
</script>

I get an error saying that divSample does not exist - but there is a div named divSample on this page.

Can you provide the complete repro?

It's sensitive data - so I created a mock up of what is occurring:

Note - because the control is on 'step 2' it doesn't see the control.

<

asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server"><atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="True"></atlas:ScriptManager><asp:WizardID="Wizard1"runat="server"ActiveStepIndex="0"><WizardSteps><asp:WizardSteprunat="server"Title="Step 1"> Welcome, click next to continue...</asp:WizardStep><asp:WizardSteprunat="server"Title="Step 2"><inputid="Text1"type="text"/><inputid="Button1"type="button"value="button"/></asp:WizardStep></WizardSteps></asp:Wizard><scripttype="text/javascript">function pageLoad()

{

$(

'Text1').control.set_visible(false);

}

function Button1_Click()

{

$(

'Text1').control.set_visible(true);

$(

'Text1').control.set_text('Hello World');

}

</script><scripttype="text/xml-script">

<page xmlns:script=

"http://schemas.microsoft.com/xml-script/2005">

<components>

<textBox id=

"Text1" />

<checkBox id=

"Button1" click="Button1_Click"/>

</components>

</page>

</script>

</

asp:Content>

Bumping for a follow up please.

Thank you


checking back in - thank you

Good day.

Checking back - any clues? Is this a bug?

I'd greatly appreciate some response - using xml-script in a wizard seems to be a senario that would be common?

I'll keep checking back everyday :)


I haven't played with this but I'll bet if you look closely at the generated HTML you'll see that the wizard doesn't generate HTML for Step 2 when you're on Step 1. The XML Script doesn't know that, so it goes looking for TextBox1 which, isn't there.

As far as how to deal with this...

What happens if you move the XMLScript inside of the Wizard two step?

What happens if you move the step contents into a UserControl?

The toolkit may be able to help you here since you can locate your extenders (they generate XML script) in the same naming scope as the extendee.


I will give that a try and report back - I appreciate the response.

It worked moving the xml-script to the wizard step.

Thanks for thinking outside of the box for me :)

Wizard Control

I am using the Wizard Control in an aspx page inside an Update Panel control. What I want to do is to navigate to this page and set which Wizard Step should be active dynamically. Something like :

if(Request["whichstep"]!=null)

Wizard1.ActiveStepIndex=int.Parse(Request["whichstep"]);

Now this works fine in that the correct Wizard step is shown when the page is loaded. But the problem is that the Wizard gets STUCK on this step. i.e. you can't use the previous/next navigation buttons to move forward or backwards.

Any help would be greatly appreciated (PS. we also tried taking the Update panel out, but the same problem exists).

HN.

can you post your code? where in your code are you checking the wizard activestepindex?

Hi boolie,

Thanks for taking the time.

The code is very simple. The page that is calling the page with the Wizard has button and its click event has Response.Redirect("WizardPage.apsx?step=3");

The page that has the Wizard on it checks on the Page_Load : if(Request["step"]!=null) Wizard1.ActiveStepIndex=Int32.Parse(Request["step"]);

As I mentioned, this works. The wizard shows the correct step. But the problem is that you can't navigate i.e. go backward or forwards using the previous/next buttons.

By the way I tried putting the code in various other events that is raised by the Wizard, they all have the same behaviour!


not sure this will fix the problem, but at least it might help eliminate some things to troubleshoot...

Are you checking for whether or not it's a postback before running the "if(Request["step"]!=null)..."?

something like this:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//code would go here...
}
}

if you haven't tried this, test it and see if you notice any difference. What might be happening is that when you click on "Next" or "Previous" it's causing the page to reload which would cause the Page_Load code to run again which would show you the same step. I could be completely wrong, but at least we'll have one troubleshooting step out of the way. Let me know what happens.



Sorry. But I should have mentioned that I do test the Postback in my last Post and it still gets Stuck. Is this some kind of Bug in the Control do you think? After all they are only panels that get their visibility changed!
I kind of thought you might be checking that already. honestly, i have no idea whether or not it's a bug, but it does seem pretty strange. i'll try some tests on my own and see if i can duplicate the problem and then maybe i can help find a solution
Many Than

Many Thanks.

Looking forward to your findings.

Wizard Control problem

This is an interesting one, although I did have it working earlier, it has since ceased to function.

I have a wizard control in an update panel on a user control on a page which uses a master page. oh, on a second note, a calendar extenders style / theme seems to break if the calendar control is not on the first page displayed in the wizard bar; but thats another story and not my immediate consern.

the problem is, that the next button returns a javascript error " 'null' is null or not an object, line 105 " ... but the odd thing is that it only breaks on the second page, so the first click of the next button works and sends you to the second page, but the second one does not work.

There is some code under the next button;

Protected Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick
If Wizard1.ActiveStepIndex = 1 Then
'some code here
end if
end sub

but it still breaks even if I comment out all the code or change the index from 1 to 2...

Thanks for reading this far, it was a bit of a long post.

Scott

you should go to your Internet Explorer's Internet Options and then go to the Advanced Tab. There you can check out 2 options: "Disable script debugging (IE)" and "Disable script debugging (other)".

Check these out and then debug. Then you can go into more detail about the javascript error.


the only extra i can add to the error message is this

Line: 104
Char: 5
Error: 'null' is null or not an object
Code: 0

I suspect that the javascript error is in the Update Panel, but im not sure...

Sorry.


Hey scott,

since nobody responded with something useful, ill give it a try ...

The error you are getting is very wide. This error can be thrown everytime an object isn't initialised at the moment you try to allocate a value to it.

because the error is so wide it's not easy for us to give a straight to the point answer.

You could try to strip down the problem into a demoProject which replicates the error so its very easy for everyone to follow what's going on.

Another thing you could do is look at the way your wizard runs through its pages. How is it set up? When creating wizards I would go for the multiview with serveral views in it for each wizardPage and then some buttons for the navigation. I made some sort of tabsControl with a multiview in an updatepanel and some navigation and all works fine :p

Good luck!


Thanks for the reply.

It gets weirder every time I look at it. In Mozilla FF it works fine; it seems only IE7 (not tried <6) stops me moving between the pages of the wizard control.

After what you said, a thought did occur to me, it stops on the page after the page containing two ajax calendar controls... but this was the wrong line of enquiry so i copied my script and progressivly removed parts until it started working.

I think this is caused by a common variable in the javascript between "something" and the required field validator control. I am using:

Modal Popup
Calendar Extender
Update Panel
and Required Field Validators

and it works fine when I remove all the validators.

I am a little behind schedule now, but I will try and recreate this on a new project later and if I get the same results with the error, it might be a small bug.

Thanks for the advice btw,

Scott M


I found out how to fix it, apparently its the required field validators use an old API to register their script !? there is a post on here somewhere (which I failed to find) that has a link to a recently compiled version of them which works flawlessly.

Wizard Control with Validation in UpdatePanel

Hi, I met a problem that I don't know how to solve when using a Wizard control with Validation in updatePanel. I am using ASP.NET 2.0 and ASP.NET 2.0 AJAX Extension 1.0. Below is the sample code and the problem I had is that after I went to Step 2 if I click Previous Button to go back to Step 1, the validator is not showing its validation result. Did I do anything wrong in my code? Would appreciate if anyone could help! Also, got a side question that how do I preserve the value in a password TextBox if I am going from Step 2 to Step 1, i.e. if the TextBox1's TextMode is set to Password, is there anyway to preserve its value?

<

formid="form1"runat="server">
<asp:ScriptManagerID="ScriptMan"runat="server" />
<asp:UpdatePanelID="UpdatePanel1"runat="server">
<ContentTemplate>
<asp:WizardID="Wizard1"runat="server"DisplaySideBar="false">
<WizardSteps>
<asp:TemplatedWizardStepID="TemplatedWizardStep1"runat="server"StepType="Start"Title="step 1">
<ContentTemplate>
Step 1<br/>
ASDF:
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
<asp:RequiredFieldValidatorID="RequiredFieldValidator1"runat="server"ControlToValidate="TextBox1"ValidationGroup="asdf"ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</ContentTemplate>
<CustomNavigationTemplate>
<asp:ButtonID="StepNextButton"runat="server"CommandName="MoveNext"Text="Next"CausesValidation="true"ValidationGroup="asdf"/>
</CustomNavigationTemplate>
</asp:TemplatedWizardStep>
<asp:TemplatedWizardStepID="TemplatedWizardStep2"runat="server"StepType="Finish"Title="step 2">
<ContentTemplate>
Step 2
</ContentTemplate>
<CustomNavigationTemplate>
<asp:ButtonID="FinishPreviousButton"runat="server"CausesValidation="False"CommandName="MovePrevious"Text="Previous"/>
<asp:ButtonID="FinishButton"runat="server"CommandName="MoveComplete"Text="Finish"/>
</CustomNavigationTemplate>
</asp:TemplatedWizardStep>
<asp:TemplatedWizardStepID="TemplatedWizardStep3"runat="server"StepType="Complete"Title="Complete">
<ContentTemplate>
Complete
</ContentTemplate>
<CustomNavigationTemplate>
<asp:ButtonID="ContinueButton"runat="server"CausesValidation="False"CommandName="Continue"Text="Continue"/>
</CustomNavigationTemplate>
</asp:TemplatedWizardStep>
</WizardSteps>
</asp:Wizard>
</ContentTemplate>
</asp:UpdatePanel>
</form>Hi, my bad that I did not do enough researching before this posting, the problem has been resolved after I fonudthis blog entry of Matt Gibbs. It turns out that it is a known issue perhttp://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx, and the workaround is to disable ClientScript of the validator controls. However, if you don't like the round trip traffic, Matt has posted Ajax Validators. I was not aware of this since I did not join the beta/CTP of the ASP.NET AJAX.

Validators are not compatablw with ASP.NET AJAX Final version..

Check this link

http://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx

You can download the stable version of Validators from here

http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx


Johnny, I am curious if you ever found a solution to your other problem about losing the password value going from step 1 to step 2. I am currently facingt the same issue and I have found no answers.

I am casting the password box in the following way:

// make reference to the password step
TemplatedWizardStep passwordStep = SelectPasswordStep;

// password step
TextBox PasswordChoice =
(TextBox)passwordStep.ContentTemplateContainer.FindControl("Password");

Response.Write(PasswordChoice.Text);

When I have the Password control set as textmode=password the text value returns blank. No error, just an empty value. When I have the textmode as singleline it works. Something about a textmode of password seems to make the control lose its value. Anybody have any ideas. Is this a bug or by design for some Redmond reason?

- jq



Chetan, thanks for you replay.

Jq, I was not working the "side problem" right now, however, I think you can preserve the actuall password string when going from step 1 to step 2, and when you go back to step 1, u could assign the password back to textbox. I guess it's not a bug and should be deisgned to be that way for security reason. I hope the work around could work, if you are going try this out, please let me know the result. Thanks.


I actually wasn't even able to get to this point. My problem is that I can't do ANYTHING with the password textbox control. Moving to the next step, referencing the control via code-behind, or anything -- once I have moved past the step with the password control, I lose the value.

So when I'm at the end of the wizard and I'm creating my account, I have lost my password value. So I can't even create the account, making my entire wizard useless. With your solution, can you read the value of the password field? If so would you mind posting your code?

Thanks,

JQ

Wizard Control, UpdatePanel, and Validation causes error in webresource.axd Bug

I have a wizard control with several steps, some of which use control validation. When placed inside an Ajax UpdatePanel, the webresource.axd javascript is no longer able to reference the controls validated in the previous step, and halts on:

WebResource.axdfunction ValidatorGetValue(id) { var control; control = document.getElementById(id); if (typeof(control.value) == "string") { return control.value; } return ValidatorGetValueRecursive(control);}

where the document.getElementById(id); returns null.

A workaround is to disable clientside validation on all validation controls, which is not a great loss when using ajax, but utterly annoying when you have gone to all the trouble of writing javascript for custom validation controls, etc.

The cause is probably complex, so I shall not comment on how it should be resolved. I assume, however, that the javascript is correct in that the controls not being rendered are in fact to be found in the DOM.

At least in my case, it would be nice if the javascript checked for null and ignored the control if it wasn't there.

Anyhow, it would be much appreciated if someone would look into it.

Thanks

In Atlas 1.0 we have updated versions of the validators that are compatible with UpdatePanel. In the current CTP I'm afraid that you'll have to use some workaround.

Thanks,

Eilon


This sounds like it could be related to my problem:

http://forums.asp.net/thread/1412888.aspx

What work arounds are available for this issue? At the moment I'm displaying all the controls in divs and just hiding them, which is pretty horrible.

Thanks,

Paul

Wizard Control, Ajax and the Enter key

I've been through quite a few posts talking about problems with the Enter key in these forums, but no-one describing exactly what I'm experiencing, so please forgive me if I've missed the answer.

I've narrowed it down to a simple repeatable scenario in a VB ASP.NET application. Create a new form, add a Scriptmanager, an UpdatePanel and a Wizard control. Put a single textbox on the first step of the wizard control. This is the crucial bit: in the code-behind Page_Load event, put TextBox1.focus(). View the new form in the browser, type any text in the textbox (focus should already be set) and hit the Enter Key. It crashes with

this._postbackSettings.async is null or not an object

Any ideas anyone? If I don't set the focus in the codebehind, but click on the textbox and then enter text, it's ok.

_Ade.

Hi

I am afraid we cannot find out the exact root cause without further information captured when the problem occurs.

To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

Thank you.


Sorry I didn't reply earlier but I've been away for a couple of weeks.

If you do exactly what I said in the original post, doesn't that reproduce the problem? It does for me.

I can send you sample code if you like, but I'm not sure how to go about it it. The only line of code I've actually *written* is "Textbox1.focus", the rest is form creation, dragging and dropping!

_Ade

Wizard inside of update panel, still getting postbacks

Hi,

I placed a wizard inside of an update panel and when I click on the button for the next step, I still get a postback. I have tried setting the mode to conditional and it still occurs.

I even tried making a new atlas website and putting nothing but the update panel with the wizard inside and it still does not work. Here is the code below. Any idea what I am doing wrong??

<atlas:ScriptManagerID="ScriptManager1"runat="server"/><div><atlas:UpdatePanelID="UpdatePanel1"runat="server"Mode="Conditional"><ContentTemplate><asp:WizardID="Wizard1"runat="server"><WizardSteps><asp:WizardSteprunat="server"Title="Step 1"></asp:WizardStep><asp:WizardSteprunat="server"Title="Step 2"></asp:WizardStep></WizardSteps></asp:Wizard></ContentTemplate></atlas:UpdatePanel>

Hi,

it seems that you are not setting EnablePartialRendering="True" in the ScriptManager control.

Yes you are right. In the sample code I pasted that was the problem (and I feel very stupid). However in my actual code I did remember to set partial rendering to true.

Now, that being said, I think I figured out what was wrong, and hopefully the Atlas guys watching this forum can tell us if I am correct.

A little more background on the page first, it is a content page and the master page has a flash banner on it that I put their using the asp.net 2.0 flash control. On my developoment machine I didn't have the flash file it was pointing to. Instead of throwing an exception when I view the page in my browser it just kept perpetually loading the page.

It occured to me that the update panel may not work properly if the page had never completed loading before a postback was called. All I had to do was copy the flash file from the webserver to my development system and VOILA! The page loads, the update panel works.


Hi,

glad to hear that you solved it :) I'll bookmark this post for future reference.

Wizard with Update Panel

I have a Wizard control with inupdatepanel . I am trying to create dynamic wizard steps in pagepre_init event, but it is giving me an error " object reference not setto an instance of an object" . without updatepanel it's workingproperly.

Thanks in Advance

Do you have a fileupload control in the wizard? If so,see this thread.

hello.

please post a simple page that reproduces this problem.

Wizard+updatepanel+usercontrols

I've got a problem using updatepanels inside the wizard.

Each of the wizard steps is a user control in my case, so I load the user controls into the steps. If two of my usercontrols contain updatepanels then I get "Microsoft JScript runtime error: Object required"

somewhere in the Atlas JavaScript code when using the Atlas functionality in the steps:

function destroyTree(element, markupContext) {

if (element.nodeType == 1) { //error on this line

if (element.control) {

markupContext.removeObject(element.control);

element.control.dispose();

}

var children = element.children;

for (var i = children.length - 1; i >= 0; i--) {

var node = children[i];

destroyTree(node, markupContext);

element.removeChild(node);

}

}

}

I've tried moving the scriptmanager wherever it is possible: in the page containing the wizard, in the user controls. It won't happen if I have only one usercontrol/wizard step using updatepanels. So if anyone encountered similar problems or have ideas how to make it work-reply.

have you tried setting Mode="Conditional" on all of your updatepanels?

http://forums.asp.net/thread/1268686.aspx

Thanks, that worked!

I've tried setting the mode to conditional on all updatepanels for sure, but probably missed one updatepanel that was set to always or something like that.Smile [:)]