Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > asp:Wizard NextButtonClick and UpdatePanel

Reply
Thread Tools

asp:Wizard NextButtonClick and UpdatePanel

 
 
JeffDotNet
Guest
Posts: n/a
 
      09-28-2009
I have a wizard that has a long running step (3-4 seconds) and I would like
to show a progress bar on the NextButtonClick of the Wizard. I am able to
get the trigger to work with a button and its click event. However when I
attempt to use the NextButtonClick of the wizard the UpdateProgress appears
as expected but the Wizard is no longer able to advance to the next step. I
have also noticed that when the Wizards NextButtonClick is occurs a second
time a dialog pops up stating there has been and ‘Invalid postback or
callback argument. Adding RegisterForEventValidation does not clear the
error.

Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)

Page.ClientScript.RegisterForEventValidation("Wiza rd1")
MyBase.Render(writer)
End Sub



I have attached a simple wizard example that shows the problem I'm having.

If someone could let me know what I’m doing wrong it would be most appreciated

Jeff


<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="SimpleWizard.aspx.vb" Inherits="SimpleWizard" %>

<!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>Simple Wizard with UpdatePanel</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<script language="javascript" type="text/jscript">

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);

var postBackElement;

function InitializeRequest(sender, args){

if (prm.get_isInAsyncPostBack())
{args.set_cancel(true);
}

postBackElement = args.get_postBackElement();

if (
(postBackElement.id == 'Button1')
|| (postBackElement.id ==
'Wizard1_StartNavigationTemplateContainerID_StartN extButton')
)
{$get('UpdateProgress1').style.display = 'block';}
}

function EndRequest(sender, args){
if (

(postBackElement.id == 'Button1')
|| (postBackElement.id ==
'Wizard1_StartNavigationTemplateContainerID_StartN extButton')
)
{$get('UpdateProgress1').style.display = 'none';}
}
</script>

</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1"
EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="Wizard1"
EventName="NextButtonClick" />

</Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1"
AssociatedUpdatePanelID="UpdatePanel1" runat="server">
<ProgressTemplate>
<br />
UpdateProgress is working
<table style="vertical-align: middle;">
<tr style="vertical-align: top">
<td>
<img src="images/indicator.gif" height="16"
width="16" />
</td>
<td style="color: Gray">
Now Processing...
</td>
</tr>
</table>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:Button ID="Button1" runat="server" Text="Test UpdatePanel
alone" OnClick="Button1_Click" />
<br />
<div style="border: solid 1pk black;">
<asp:Wizard ID="Wizard1" runat="server" DisplaySideBar="false">
<StartNavigationTemplate>
<div>
<asp:Button ID="StartCancelButton" runat="server"
BackColor="#FFFBFF" BorderColor="#CCCCCC"
BorderStyle="Solid" BorderWidth="1px"
CommandName="Cancel" Font-Names="Verdana"
Font-Size="0.8em" ForeColor="#284775" Text="Cancel"
AccessKey="c" CssClass="cancelButton"
CausesValidation="false" ToolTip="Alt+c"
Style="position: relative; left: -495px;
bottom: 5px;" />
<asp:Button ID="StartNextButton" runat="server"
BackColor="#FFFBFF" BorderColor="#CCCCCC"
BorderStyle="Solid" BorderWidth="1px"
CommandName="MoveNext" Font-Names="Verdana"
Font-Size="0.8em" ForeColor="#284775" Text="Next"
AccessKey="n" Style="position: relative; bottom:
5px; right: 10px;" />
</div>
</StartNavigationTemplate>
<WizardSteps>
<asp:WizardStep runat="server" Title="Step 1">
<div style="width: 500px; height: 200px; border:
solid 1pk black; background-color:Bisque">
<ul>
<li>Click the <span style="
font-style:italic">Test UpdateProgress alone</span> to verify the
UpdateProgress works without involving the wizard</li>
<li>Click the <span style="
font-style:italic">Next</span> button on the wizard to trigger the
UpdatePanel</li>
</ul>
<br />
Unfortunetly attempting to trigger from the
Wizard1 NextButtonClick event causes the UpdatePanel to jump but not display
the progress panel and does not allow the Wizard to advance to the next step.
</div>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 2">
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
</div>
</div>
</form>
</body>
</html>

!--- CodeBehind --

Option Strict On
Option Explicit On

Partial Class SimpleWizard
Inherits System.Web.UI.Page

Public Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
System.Threading.Thread.Sleep(2000)
End Sub


Public Sub Wizard1_NextButtonClick(ByVal sender As Object, ByVal e As
WizardNavigationEventArgs) Handles Wizard1.NextButtonClick
System.Threading.Thread.Sleep(2000)
End Sub

Protected Overrides Sub Render(ByVal writer As
System.Web.UI.HtmlTextWriter)
Page.ClientScript.RegisterForEventValidation("Wiza rd1")
MyBase.Render(writer)
End Sub

End Class



 
Reply With Quote
 
 
 
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      09-30-2009
Hi,

>I have a wizard that has a long running step (3-4 seconds) and I would

like
>to show a progress bar on the NextButtonClick of the Wizard. I am able

to
>get the trigger to work with a button and its click event. However when I
>attempt to use the NextButtonClick of the wizard the UpdateProgress

appears
>as expected but the Wizard is no longer able to advance to the next step.

I
>have also noticed that when the Wizards NextButtonClick is occurs a second
>time a dialog pops up stating there has been and ‘Invalid postback or
>callback argument. Adding RegisterForEventValidation does not clear the
>error.


If you want to update the Wizard control on async postback please put it in
the ContentTemplate of UpdatePanel. Below is the updated code that works on
my side. Please test it to see if it's what you need:

<asp:Button ID="Button1" runat="server" Text="Test
UpdatePanel
alone" OnClick="Button1_Click" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1"
EventName="Click" />


</Triggers>
<ContentTemplate>
<div style="border: solid 1pk black;">
<asp:Wizard ID="Wizard1" runat="server"
DisplaySideBar="false">
<StartNavigationTemplate>
<div>
<asp:Button ID="StartCancelButton" runat="server"
BackColor="#FFFBFF" BorderColor="#CCCCCC"
BorderStyle="Solid" BorderWidth="1px"
CommandName="Cancel" Font-Names="Verdana"
Font-Size="0.8em" ForeColor="#284775" Text="Cancel"
AccessKey="c" CssClass="cancelButton"
CausesValidation="false" ToolTip="Alt+c"
Style="position: relative; left: -495px;
bottom: 5px;" />
<asp:Button ID="StartNextButton" runat="server"
BackColor="#FFFBFF" BorderColor="#CCCCCC"
BorderStyle="Solid" BorderWidth="1px"
CommandName="MoveNext" Font-Names="Verdana"
Font-Size="0.8em" ForeColor="#284775" Text="Next"
AccessKey="n" Style="position: relative; bottom:
5px; right: 10px;" />
</div>
</StartNavigationTemplate>
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server"
Title="Step 1">
<div style="width: 500px; height: 200px; border:
solid 1pk black; background-color:Bisque">
<ul>
<li>Click the <span style="
font-style:italic">Test UpdateProgress alone</span> to verify the
UpdateProgress works without involving the wizard</li>
<li>Click the <span style="
font-style:italic">Next</span> button on the wizard to trigger the
UpdatePanel</li>
</ul>
<br />
Unfortunetly attempting to trigger from the
Wizard1 NextButtonClick event causes the UpdatePanel to jump but not
display
the progress panel and does not allow the Wizard to advance to the next
step.
</div>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server"
Title="Step 2">
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
</div></ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1"
AssociatedUpdatePanelID="UpdatePanel1" runat="server">
<ProgressTemplate>
<br />
UpdateProgress is working
<table style="vertical-align: middle;">
<tr style="vertical-align: top">
<td>
<img src="images/indicator.gif" height="16"
width="16" />
</td>
<td style="color: Gray">
Now Processing...
</td>
</tr>
</table>
</ProgressTemplate>
</asp:UpdateProgress>

If you have additional questions please don't hesitate to let me know. I'll
do my best to follow up.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      10-02-2009
Hi,

>I have a wizard that has a long running step (3-4 seconds) and I would

like
>to show a progress bar on the NextButtonClick of the Wizard. I am able

to
>get the trigger to work with a button and its click event. However when I
>attempt to use the NextButtonClick of the wizard the UpdateProgress

appears
>as expected but the Wizard is no longer able to advance to the next step.

I
>have also noticed that when the Wizards NextButtonClick is occurs a second
>time a dialog pops up stating there has been and ‘Invalid postback or
>callback argument. Adding RegisterForEventValidation does not clear the
>error.


Can my code work?

Regards,
Allen Chen
Microsoft Online Support

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triggering an UpdatePanel with a trigger located outside of the UpdatePanel Nathan Sokalski ASP .Net 1 06-15-2009 06:23 PM
refresh an updatePanel in an other updatePanel fran_j_diaz@yahoo.fr ASP .Net 3 08-08-2007 06:30 AM
Master Pages and Ajax UpdatePanel =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 0 10-06-2006 09:10 PM
GridView and NextButtonClick Bruno Alexandre ASP .Net Datagrid Control 2 06-09-2006 08:16 AM
GridView and NextButtonClick Bruno Alexandre ASP .Net 0 06-07-2006 04:12 PM



Advertisments