 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

November 13th, 2011, 04:16 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
CreateUser Wizard
Hello folks,
I have few questions about create user wizard.
First is how we can get client id of create user button in createuser wizard?
Thanks.
|
|

November 13th, 2011, 04:21 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Just look in the final HTML in the browser and you'll see the ID.
You can also convert the control to a template using the Smart Tasks panel and then manually set the client ID, or assign a CSS class in case you want to access the button with jQuery.
Cheers,
Imar
|
|

November 13th, 2011, 04:47 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Hi Imar,
I have followed both options already. Using the Id I got from HTML works fine. but it sometimes causes problems when we change it to Image button/ link button then its id changes accordingly and hence requires manual updation of code.
Regarding second approach I have already done so, but I can not see any create button reference. Code all the way down of wizard is like this...
Code:
<tr>
<td align="center" colspan="2">
<asp:RegularExpressionValidator ID="EmailRegExp" runat="server"
ControlToValidate="Email" Display="Dynamic"
ErrorMessage="Please enter e-mail in proper format."
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ValidationGroup="CreateUserWizard1"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<div style="text-align:center; color:Red;">
<asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>
</div>
</td>
</tr>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
Thanks...
|
|

November 14th, 2011, 03:58 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
If you choose Convert to Custom Navigation template on the Smart Tasks panel you'll get the HTML for the Create User button.
Cheers,
Imar
|
|

November 14th, 2011, 12:08 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Hi Imar,
I can see the id of button now, it is StepNextButton. But I am having problem while accessing its client id in jquery.
I am using following code.
Code:
$("#<%= CreateUserWizard1.ClientID %>_CreateUserStepContainer_StepNextButton").click(function ()
What is wrong here???
|
|

November 14th, 2011, 01:49 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
How does the ID end up in the client code and does that align with the actual ID? Can you post both?
Two alternatives:
1. Set the ClientIDMode to override the ID
2 Use a CSS class and then use .YourClass to get access to the button.
Cheers,
Imar
|
|

November 14th, 2011, 02:22 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Hi Imar,
in actual code it is
Code:
<StepNavigationTemplate>
<asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False"
CommandName="MovePrevious" Text="Previous" />
<asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext"
Text="Next" />
</StepNavigationTemplate>
in the client code it is referenced as...
Code:
<td align="right"><input type="image" name="CreateUserWizard1$__CustomNav0$StepNextButtonImageButton" id="CreateUserWizard1___CustomNav0_StepNextButtonImageButton" src="Images/button.png" alt="Create User" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("CreateUserWizard1$__CustomNav0$StepNextButtonImageButton", "", true, "CreateUserWizard1", "", false, false))" /></td>
|
|

November 14th, 2011, 02:46 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yes? And what about the code with the jQuery in it? And did you try my other two suggestions? Way easier to implement.....
Cheers,
Imar
|
|

November 14th, 2011, 03:49 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
I am using the following jquery in head section:
Code:
<script type="text/javascript">
$(document).ready(function ()
{
$("#<%= CreateUserWizard1.ClientID %>_CreateUserStepContainer_StepNextButton").click(function ()
{
I am using the image button for create user button in this example. I am trying with other two alternatives.
|
|

November 14th, 2011, 04:08 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
while I am working with first question, there is one more question.
I have setup requiresQuestionAndAnswe to false in web.config file. it works as intended when create user wizard is in its default form but when it is in its template form then this does not work.
How this behavior can be conquered?
Thanks
|
|
 |
|