I'm building a login and register page for a website with Asp.Net
In login page have a popup register form.
A problem in this is : I wanna use my validate for user but I cannot disable validator of CreateUserWizard.
1/ How can I turn off the Validator ? It doesnt work nice.
2/ If I have a textbox or another component in Wizard Template (ex : a textbox in ContentTemplate of CreateUserWizard. How can I call that textbox in my code ? I dont wanna use question and anwser box. I wanna use a new field but I can't call it in my code.
Thanks and sorry for my English
<asp:CreateUserWizard ID="CreateUserWizard2" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep2" runat="server">
<ContentTemplate>
<table>
<tr>
<td align="center" colspan="2">
Sign Up for Your New Account</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Password is required."
ToolTip="Password is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="ConfirmPasswordLabel" runat="server"
AssociatedControlID="ConfirmPassword">Confirm Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server"
ControlToValidate="ConfirmPassword"
ErrorMessage="Confirm Password is required."
ToolTip="Confirm Password is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label>
</td>
<td>
<asp:TextBox ID="Email" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="EmailRequired" runat="server"
ControlToValidate="Email" ErrorMessage="E-mail is required."
ToolTip="E-mail is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="QuestionLabel" runat="server" AssociatedControlID="Question">Security Question:</asp:Label>
</td>
<td>
<asp:TextBox ID="Question" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="QuestionRequired" runat="server"
ControlToValidate="Question" ErrorMessage="Security question is required."
ToolTip="Security question is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="Answer">Security Answer:</asp:Label>
</td>
<td>
<asp:TextBox ID="Answer" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="AnswerRequired" runat="server"
ControlToValidate="Answer" ErrorMessage="Security answer is required."
ToolTip="Security answer is required." ValidationGroup="CreateUserWizard2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:CompareValidator ID="PasswordCompare" runat="server"
ControlToCompare="Password" ControlToValidate="ConfirmPassword"
Display="Dynamic"
ErrorMessage="The Password and Confirmation Password must match."
ValidationGroup="CreateUserWizard2"></asp:CompareValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
</table>
</ContentTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep2" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
The wizards a generally that - closed wizards. You can easily create your own login / registration using the membership classes as exposed in code. Then you have full control over them.
Related
i have an user control in that i used cascading drop down for states,districts and areas...how to load cascading drop down in user control page load....cascading Drop down code is
<table>
<tr>
<td class="caption">
State:
<asp:DropDownList ID="ddlCState" runat="server" CssClass="userentry">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cdlCStates" TargetControlID="ddlCState" PromptText="Select State"
ServicePath="~/CasCadingDropDown.asmx" ServiceMethod="GetStates" runat="server"
Category="StateId" LoadingText="Loading..." />
</td>
</tr>
<tr>
<td class="caption">
District:
<asp:DropDownList ID="ddlCDistrict" runat="server" CssClass="userentry">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cdlCDistrict" TargetControlID="ddlCDistrict" PromptText="Select District"
ServicePath="~/CasCadingDropDown.asmx" ServiceMethod="GetDistricts" runat="server"
Category="DistrictId" ParentControlID="ddlCState" LoadingText="Loading..." />
</td>
</tr>
<tr>
<td class="caption">
Area:
<asp:DropDownList ID="ddlCArea" runat="server" CssClass="userentry">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cdlCAreas" TargetControlID="ddlCArea" PromptText="Select Area"
ServicePath="~/CasCadingDropDown.asmx" ServiceMethod="GetAreas" runat="server"
Category="AreaId" ParentControlID="ddlCDistrict" LoadingText="Loading..." />
</td>
</tr></table>
I'm using required field validator to validate textbox.
<tr>
<td>
<asp:Label ID="lbllogin" runat="server" Text="Registration ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtloginid" runat="server" AutoPostBack="true"
ontextchanged="txtloginid_TextChanged" TabIndex="1"
ToolTip="Enter Registration Id" Width="150px"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="reqloginid" runat="server"
ControlToValidate="txtloginid" Display="Dynamic" ErrorMessage="*"
ToolTip="Enter Registration Id" ValidationGroup="User_login"
ForeColor="#CC3300" SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
</tr>
Now i want to add color to textbox , how can i do it with required filed validator. i'm using updatepanel. thanks in advance
I am using dropdownlist placed inside ajax tab container.but it doesnt postback even though i have set autopostback property to true.This happens only in firefox and not in IE or chrome.Can any body help me regarding this.I am using ajax toolkit version 4.1.50731.0.
<asp:TabContainer ID="TabContainer2" runat="server" Width="100%" CssClass="myTab"
Height="2200px" ActiveTabIndex="0">
<asp:TabPanel ID="TabPanel8" runat="server" HeaderText="Add Transaction">
<ContentTemplate>
<div>
<table class="style1">
<tr>
<td class="style16">
</td>
<td align="right" class="style15">
Select News Heading :
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
AutoPostBack="True" >
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="DropDownList1"
ErrorMessage="Please Select News Heading" ValidationGroup="a" InitialValue="Select News Heading">*</asp:RequiredFieldValidator><asp:ValidatorCalloutExtender
ID="RequiredFieldValidator12_ValidatorCalloutExtender" runat="server" Enabled="True"
TargetControlID="RequiredFieldValidator12">
</asp:ValidatorCalloutExtender>
<asp:Label ID="Label3" runat="server"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td class="style16">
</td>
<td align="right" class="style15">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="style16">
</td>
<td align="right" class="style15">
Select Sub Heading :
</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server" OnLoad="DropDownList2_Load">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ControlToValidate="DropDownList2"
ErrorMessage="Please select sub heading" ValidationGroup="a" InitialValue="Select News Name">*</asp:RequiredFieldValidator><asp:ValidatorCalloutExtender
ID="RequiredFieldValidator14_ValidatorCalloutExtender" runat="server" Enabled="True"
TargetControlID="RequiredFieldValidator14">
</asp:ValidatorCalloutExtender>
<asp:Label ID="Label4" runat="server"></asp:Label>
</td>
<td>
</td>
</tr>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
you do appear to be missing a closing </table> and </div> tag from your content template.
does adding those fix your problem?
edit
Does your javascript console (e.g. firebug in firefox) give you any javascript errors?
Solution to your problem that I assume is:
If validation is failing then DropDownList won't PostBack, so please try once by disabling the Validators on DropDownList.
Some points to note
RequiredFieldValidator should have Display="None" as you are using ValidatorCalloutExtender
Put CausesValidation on the DropDownList and RequiredFieldValidator
It would result in auto triggering the validation on server-side.
Check the Page.IsValid in the SelectedIndexChanged event handler before proceeding any other code parts.
i am making a asp.net website where an user can change password .. by clicking a button changepassword i am redirecting to a new asp page where i have a user code field and a old password filed and a new password field like this:
<table width="100%">
<tr>
<td>
<asp:Label ID="Label5" runat="server" Text="User Code: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtusercd2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label6" runat="server" Text="Enter Old Password: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtoldpwd" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label7" runat="server" Text="Enter New Password: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtnewpwd" runat="server" TextMode="Password"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label8" runat="server" Text="Re-Enter New Password: "></asp:Label>
</td>
<td>
<asp:TextBox ID="txtrepwd" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblmsg2" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td style="float:right">
<asp:ImageButton ID="btnchngpwd" runat="server" ImageUrl="~/images/Save.png" />
</td>
</tr>
</table>
now the problem is when i am redirecting to that page my code filed and old password is getting populated by the user login details
i dont want to populate the old password filed . what shold i do?
That's the webbrowser auto-populating it for you. Add the autocomplete="off" attribute to each <input /> element that is being inappropriately filled.
This may be a long shot, but I'm trying to use the client side ajax calendar to select a range of dates for the x-axis of my server side chart. I have both controls set up, I'm just not sure how to get them to communicate with each other or if it's even possible.
This is what I have so far:
<table>
<tr>
<td>
Start Date
</td>
<td>
<asp:TextBox ID="StartDateTextBox" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="StartCal" runat="server"
TargetControlID="StartDateTextBox">
</ajaxToolkit:CalendarExtender>
</td>
<td>
End Date
</td>
<td>
<asp:TextBox ID="EndDateTextBox" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="EndCal" runat="server" TargetControlID="EndDateTextBox">
</ajaxToolkit:CalendarExtender>
</td>
</tr>
<tr>
<td colspan="4">
<asp:Chart ID="TrendChart" runat="server" Width="800px" Height="400px">
<Series>
<asp:Series Name="Trend" ChartType="Line">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="true">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
</td>
</tr>
<tr>
<td align="center" colspan="4">
<asp:Button ID="TrendChartButton" runat="server" Text="Export To CSV"
CommandArgument="TrendChart" onclick="OverviewChartButton_Click" />
</td>
</tr>
</table