[RESOLVED] Need help with asp wizard control, how to pass additional parameters into the next button

I have a step in the wizard process, where I have three different buttons that call the next step button.   I need to track which button was pressed.   How can I do this by adding CommandArgument="Button1", CommandArgument="Button2" to the asp:ImageButton markup?    How would I retrieve that in the NextButton Event Procedure?

<asp:ImageButton runat="server" ID="Button1" CommandArgument="Button1" CommandName="MoveNext" ImageUrl="../images/MyHealthCommunity/wellness/iLargeArrow.png" width="31" height="31" align="absmiddle"/>

 

protected void NextButton_Click(object sender, WizardNavigationEventArgs e)

{

Wizard wzd = (Wizard)sender;

 

}

 

Hi bb2j3z,

There are two ways to achieve what you want, not exactly the way you may like but the ways to achieve what you need.

1) You cannot determine which button fired the movenext event of the create user wizard control but you can use the WizardNavigationEventArgs to determine the currentstepindex, in turn it can be used to easily determine which button may have been pressed, I mean you definitely know which button is in which wizard step, don't you??.

 

2) You can handle the button's click event instead of supplying the commandname and handling the movenext event of the createuserwizard control. If you want to handle the events separately for different next buttons then you can easily determine which button fired the event. But if you want to handle the events using a single event handler then you can cast the sender object to the button type and determine it's command argument. And besides you can increase the wizard step by incrementing the ActiveStepIndex property of createuserwizard control in you next button click event as 

CreateUserWizard1.ActiveStepIndex += CreateUserWizard1.ActiveStepIndex;

 

Take a thorough look at these tutorials

http://msdn.microsoft.com/en-us/library/ms178342.aspx

http://www.4guysfromrolla.com/articles/050609-1.aspx

 

 

 

 

 

1 thoughts on "[RESOLVED] Need help with asp wizard control, how to pass additional parameters into the next button"

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>