Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
 
Old November 13th, 2011, 04:16 PM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile 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.
 
Old November 13th, 2011, 04:21 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 13th, 2011, 04:47 PM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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...
 
Old November 14th, 2011, 03:58 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 14th, 2011, 12:08 PM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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???
 
Old November 14th, 2011, 01:49 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 14th, 2011, 02:22 PM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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(&quot;CreateUserWizard1$__CustomNav0$StepNextButtonImageButton&quot;, &quot;&quot;, true, &quot;CreateUserWizard1&quot;, &quot;&quot;, false, false))" /></td>
 
Old November 14th, 2011, 02:46 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 14th, 2011, 03:49 PM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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.
 
Old November 14th, 2011, 04:08 PM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

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




Similar Threads
Thread Thread Starter Forum Replies Last Post
Provider error by CreateUser dbardelt BOOK: Silverlight 4 Problem - Design - Solution 4 June 6th, 2011 08:21 AM
UserInformationService.CreateUser p115 Gabor66 BOOK: Silverlight 4 Problem - Design - Solution 1 May 14th, 2010 03:50 AM
wizard control Bill Crawley ASP.NET 2.0 Professional 0 July 12th, 2007 09:55 AM
CreateUser Error Gadall ASP.NET 2.0 Professional 1 May 9th, 2007 01:15 AM
Saving personalization properties w/CreateUser k8277 ASP.NET 2.0 Basics 0 April 5th, 2007 01:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.