hi i'm using the maskeditexdenter for getting money value ,the problem is when the input is given it takes it from left to right i want it to take it from right to left. the code is
<asp:TextBox ID="txt_actual_ConveyanceCharges" CssClass="Controls" runat="server"></asp:TextBox>
<ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txt_actual_ConveyanceCharges" Mask="99,999,999.99" MaskType=Number InputDirection="RightToLeft"/>
Hai anand Try this,
<ajaxToolkit:MaskedEditExtender runat="server"
TargetControlID="UrTxtBoxID"
Mask="9,999,999.99"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Number"
InputDirection="RightToLeft"
AcceptNegative="Left"
DisplayMoney="Left"
/>
Related
The month part of the calendar is missing. Please find the code which i am using :
<cc1:CalendarExtender ID="txtfrom_CalendarExtender" runat="server"
Enabled="True" TargetControlID="txtfrom"
>
</cc1:CalendarExtender>
<asp:Label ID="Labeldateto" runat="server" Text="To:"></asp:Label>
<asp:TextBox ID="txtto" runat="server" Display="None"
class="Input" Height="16px" Width="136px"></asp:TextBox>
<cc1:CalendarExtender ID="txtto_CalendarExtender1" runat="server"
Enabled="True" TargetControlID="txtto"
>
</cc1:CalendarExtender>
</td>
I am getting output like
Please advice!!
please find the correct code to solve mention issue.
I've seen a variety of questions here that are very close to this issue but none which seem to fit this specific scenario.
Description:
I have ID and Password fields with a Log On button in the Master page. These are in the "LoginValidationGroup" and they work fine.
Now, in the Default.aspx, I have an email TextBox and submit button that are in the "NotifyMeValidation" group, and they also work, BUT not if you hit the enter key rather than the submit button. The Submit button works fine - Enter key ... not so much.
The Enter key causes the validation to occur on the LoginValidationGroup, even though the TextBox is set to CausesValidation="true", and it is in the NotifyMeValidation group.
I guarantee people are going to enter an email in that box and hit Enter. I would!!! And when they do, they're going to see a callout balloon at the top telling them the User ID is required.
What's my error here? If I need to post the actual code I can do so.
Actually, let me just go ahead and do that.
From the Default.aspx:
<asp:RequiredFieldValidator
runat="server"
ValidationGroup="NotifyMeValidation"
ID="EmailRequiredValidator"
ControlToValidate="SenderEmailTextBox"
ErrorMessage="Email is Required"
Display="None" />
<ajaxToolkit:ValidatorCalloutExtender
runat="Server"
PopupPosition="Left"
ID="EmailRequiredValidatorExtender"
Width="185px"
TargetControlID="EmailRequiredValidator"
WarningIconImageUrl="/Images/warning.gif" />
<asp:Label ID="SenderEmailLabel" runat="server" ssociatedControlID="SenderEmailTextBox" EnableViewState="false" Text="Email:"></asp:Label>
<asp:TextBox ID="SenderEmailTextBox" runat="server" ValidationGroup="NotifyMeValidation" Width="350" BackColor="#cccccc" CausesValidation="true"></asp:TextBox>
<br /><br />
<asp:Button ID="SubmitButton" runat="server" ValidationGroup="NotifyMeValidation" EnableViewState="false" CssClass="submit" Text="Send" CausesValidation="true" OnClick="btnSubmit_Click" />
From the Master page:
<asp:Label CssClass="LoginHeading" ID="UserNameLabel" runat="server" AssociatedControlID="UserNameTextbox">UserName: </asp:Label>
<asp:TextBox CssClass="LoginTextBox" ID="UserNameTextbox" runat="server" ValidationGroup="LoginValidation" CausesValidation="True"></asp:TextBox>
<asp:Label CssClass="LoginHeading" ID="PasswordLabel" runat="server" AssociatedControlID="PasswordTextbox">Password: </asp:Label>
<asp:TextBox CssClass="LoginTextBox" ID="PasswordTextBox" runat="server" TextMode="Password" ValidationGroup="LoginValidation" CausesValidation="True"></asp:TextBox>
<asp:Button CssClass="LoginHeading" ID="LoginButton" runat="server" Text="Button" CommandName="Login" ValidationGroup="LoginValidation" CausesValidation="True" onclick="LoginButton_Click" />
And the Master page validators...
<asp:RequiredFieldValidator runat="server" ID="UIDRequired"
ValidationGroup="LoginValidation"
ControlToValidate="UserNameTextbox"
Display="None"
ErrorMessage="<b>Required Field Missing</b><br />A User ID is required." />
<ajaxToolkit:ValidatorCalloutExtender
runat="Server"
ID="UIDValidationExtender"
PopupPosition="Left"
Width="185px"
TargetControlID="UIDRequired"
WarningIconImageUrl="/Images/warning.gif" />
<asp:RequiredFieldValidator runat="server" ID="PWRequired"
ValidationGroup="LoginValidation"
ControlToValidate="PasswordTextbox"
Display="None"
ErrorMessage="<b>Required Field Missing</b><br />A password is required." />
<ajaxToolkit:ValidatorCalloutExtender
runat="Server"
ID="PWValidationExtender"
PopupPosition="Left"
TargetControlID="PWRequired"
Width="185px"
WarningIconImageUrl="/Images/warning.gif" />
<asp:CustomValidator
runat="server"
Display="None"
ValidationGroup="LoginValidation"
ID="CustomUserExistsValidator"
ControlToValidate="UserNameTextbox"
ErrorMessage="<b>Invalid UserID!</b><br />User ID doesn't exist. Please try again.<br />"
OnServerValidate="CustomCheckUserExists"/>
<ajaxToolkit:ValidatorCalloutExtender
runat="server"
PopupPosition="Left"
ID="UserIDCalloutExtender"
TargetControlID="CustomUserExistsValidator"
Width="185px"
WarningIconImageUrl="/Images/warning.gif" />
<asp:CustomValidator
runat="server"
ID="CustomPWValidator"
Display="None"
ValidationGroup="LoginValidation"
ControlToValidate="PasswordTextbox"
ErrorMessage="<b>Invalid Password!</b><br />Please try again.<br />"
OnServerValidate="CustomValidatePassword"/>
<ajaxToolkit:ValidatorCalloutExtender
runat="server"
PopupPosition="Left"
ID="PWCalloutExtender"
TargetControlID="CustomPWValidator"
Width="185px"
WarningIconImageUrl="/Images/warning.gif" />
<asp:CustomValidator
runat="server"
ID="CustomUserApprovedValidator"
Display="None"
ValidationGroup="LoginValidation"
ControlToValidate="UserNameTextbox"
ErrorMessage="<b>Approval Error!</b><br />This UserID exists, but is not yet approved.<br />"
OnServerValidate="CustomCheckUserApproved"/>
<ajaxToolkit:ValidatorCalloutExtender
runat="server"
PopupPosition="Left"
ID="UserApprovedCalloutExtender"
TargetControlID="CustomUserApprovedValidator"
Width="185px"
WarningIconImageUrl="/Images/warning.gif" />
Try adding an <asp:Panel> around each set of controls and setting the DefaultButton property to the ID of the button you want to click when the users hits Enter.
Just to explain what is happening here, the aspx's default button is being fired when you press enter on the textbox. To handle this you could you could fire some jQuery code when the enter key is clicked on the textbox, this code will then perform the click on the specific button that you require. Check this
I have a required field Validator on a text-box that has a Watermark on it. I am using Ajax Toolkit ValidatorCalloutExtender. The user can still click the submit button without any validation occurring. I have researched online but could not find a useful info. I am not sure what i am missing here.
<EditItemTemplate>
<asp:TextBox ID="TextBox6" runat="server" Width="403px"
Text='<%# Bind("Email") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldEmail" runat="server"
ErrorMessage="*** This is a required field ***" ControlToValidate="TextBox6" Display="None"
Font-Bold="True" ForeColor="#FF3300"></asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtenderEmail" runat="server" TargetControlID="RequiredFieldEmail" HighlightCssClass="validatorCalloutHighlight">
</ajaxToolkit:ValidatorCalloutExtender>
<ajaxToolkit:TextBoxWatermarkExtender ID="AuthorEmail_TextBoxWatermarkExtender" runat="server"
Enabled="True" WatermarkText="<<Type the first 4 letters of the first name to autopopulate>>"
TargetControlID="TextBox6">
</ajaxToolkit:TextBoxWatermarkExtender>
<ajaxToolkit:AutoCompleteExtender ID="autoComplete00" runat="server" EnableCaching="true"
BehaviorID="AutoCompleteExa" MinimumPrefixLength="3" TargetControlID="TextBox6"
ServicePath="../AutoComplete.asmx" ServiceMethod="GetCompletionList" CompletionInterval="1000"
CompletionSetCount="10" CompletionListCssClass="autocomplete_completionListElement"
CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
DelimiterCharacters=";, :" ShowOnlyCurrentWordInCompletionListItem="true">
</ajaxToolkit:AutoCompleteExtender>
</EditItemTemplate>
Set the InitialValue of the RequiredFieldValidator as the WatermarkText. Modify the markup of your requiredfieldvalidator like below and see if it helps.
<asp:RequiredFieldValidator ID="RequiredFieldEmail" runat="server" ErrorMessage="*** This is a required field ***" ControlToValidate="TextBox6" Display="None" InitialValue="<<Type the first 4 letters of the first name to autopopulate>>" Font-Bold="True" ForeColor="#FF3300"></asp:RequiredFieldValidator>
I have a RequiredFieldValidator. The code is below:
<asp:TextBox runat="server" ID="phone" MaxLength="10" Columns="10"
Width="90px"></asp:TextBox>
<asp:MaskedEditExtender ID="phone_MaskedEditExtender" runat="server" CultureAMPMPlaceholder=""
CultureCurrencySymbolPlaceholder="" CultureDateFormat="" CultureDatePlaceholder=""
CultureDecimalPlaceholder="" CultureThousandsPlaceholder="" CultureTimePlaceholder=""
Enabled="True" TargetControlID="phone" Mask="(999)999-9999" ClearMaskOnLostFocus="False">
</asp:MaskedEditExtender>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidatorPhone" ControlToValidate="phone"
ErrorMessage="Phone is required." Display="Dynamic" InitialValue="" />
If I remove the asp:MaskedEditExtender, the RequiredFieldValidator functions as expected. Otherwise it seems the validator loses its functionality.
Why?
Thanks.
Your MaskedEditExtender isn't doing anything but declaring a mask, and putting itself in the place of the value of your input.
All those Cultures are not needed in the case of a phone number.
What is the validation expression?
The whole point of the MaskedExtender is to control the input type. If you are using ASP you can do this by pulling from database and restricting the max length of the field.
Here is an example.
<cc1:MaskedEditExtender ID="MaskedEditExtender1"
runat="server"
TargetControlID="txtClientLookupValue"
Mask="999999-9999"
ClearMaskOnLostFocus="false">
</cc1:MaskedEditExtender>
<cc1:MaskedEditValidator ID="MaskedEditValidator1"
ControlExtender="MaskedEditExtender1"
runat="server"
ControlToValidate="txtClientLookupValue"
IsValidEmpty="True"
InvalidValueMessage="INVALID"
ValidationExpression="^[2-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]$"
Display="Dynamic">
</cc1:MaskedEditValidator>
And here is a reference:
MaskedEditExtenderLinkASP
Good Luck.
Here is how I do phone numbers in ASP.NET (mask and validation). Just trying to help!
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="txb_HomePhoneNumb"
Cssclass="BoxStyleHireAppCityStateZip" runat="server"
Width="175" MaxLength="12">
</asp:TextBox>
<%--MaskedEditExtender Created with: ASP.NET AJAX Control
Toolkit: https://ajaxcontroltoolkit.codeplex.com--%>
<cc1:MaskedEditExtender ID="MaskedEditExtenderHomePhoneNumb"
runat="server"
TargetControlID="txb_HomePhoneNumb"
ClearMaskOnLostFocus ="false"
MaskType="None"
Mask="(999) 999-9999"
MessageValidatorTip="true"
InputDirection="LeftToRight"
ErrorTooltipEnabled="True"
/>
<asp:RegularExpressionValidator runat="server"
ControlToValidate="txb_HomePhoneNumb" style="color:red;"
CssClass="display-next"
ErrorMessage="*Not a valid phone number!"
ValidationExpression="^\D?(\d{3})\D?\D?(\d{3})\D?
(\d{4})$" Font-Size="Medium">
</asp:RegularExpressionValidator>
</div>
I want to use maskededit to make the user to do the same as in the ajax control toolkit sample for maskededit, but I need to use another format, since dates at my client is displayed as dd-MM-yyyy. I also need to put a value in there to begin with, since the date is loaded from a db (once I get this code working, that is)
Look at this sample:
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/maskededit/maskededit.aspx
I need to do the same as in the textbox labeled "Enter Date (format: 99/99/9999): "
I downloaded the sample code and changed the format to "99-99-9999" in the relevant code:
But the sample date "12-12-1999" is not displayed in the textbox. Why not?
I cant figure out, what I am doing wrong. I also tried setting the cultureName to da-DK, but it did not chance anything. I also tried Chrome, Firefox and IE7, same behaviour...
How do I fix this?
<asp:TextBox ID="TextBox5" runat="server" Width="130px" MaxLength="1" style="text-align:justify" ValidationGroup="MKE">12-12-1999</asp:TextBox>
<asp:ImageButton ID="ImgBntCalc" runat="server" ImageUrl="~/images/Calendar_scheduleHS.png" CausesValidation="False" />
<ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender5" runat="server"
TargetControlID="TextBox5"
Mask="99-99-9999"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Date"
DisplayMoney="Left"
AcceptNegative="Left"
ErrorTooltipEnabled="True" />
<ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator5" runat="server"
ControlExtender="MaskedEditExtender5"
ControlToValidate="TextBox5"
EmptyValueMessage="Date is required"
InvalidValueMessage="Date is invalid"
Display="Dynamic"
TooltipMessage="Input a date"
EmptyValueBlurredText="*"
InvalidValueBlurredMessage="*"
ValidationGroup="MKE" />
I suposse you'll have this already fixed, but ... have you tried using UserDateFormat="DayMonthYear" ?
UserDateFormat="DayMonthYear"
<asp:TextBox ID="TextBox5" runat="server" Width="130px" MaxLength="1" style="text-align:justify" ValidationGroup="MKE">12-12-1999</asp:TextBox>
<asp:ImageButton ID="ImgBntCalc" runat="server" ImageUrl="~/images/Calendar_scheduleHS.png" CausesValidation="False" />
<ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender5" runat="server"
TargetControlID="TextBox5"
Mask="99-99-9999"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Date"
DisplayMoney="Left"
AcceptNegative="Left"
ErrorTooltipEnabled="True" **UserDateFormat="DayMonthYear"** />
<ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator5" runat="server"
ControlExtender="MaskedEditExtender5"
ControlToValidate="TextBox5"
EmptyValueMessage="Date is required"
InvalidValueMessage="Date is invalid"
Display="Dynamic"
TooltipMessage="Input a date"
EmptyValueBlurredText="*"
InvalidValueBlurredMessage="*"
ValidationGroup="MKE" />
I use ValidationExpression in MaskedEditValidator replace userDateFormat type Date dd/MM/yyy is very good.
This is :
ValidationExpression="(((((0[1-9])|(1\d)|(2[0-8]))\/((0[1-9])|(1[0-2])))|((31\/((0[13578])|(1[02])))|((29|30)\/((0[1,3-9])|(1[0-2])))))\/((20[0-9][0-9])|(19[0-9][0-9])))|((29\/02\/(19|20)(([02468][048])|([13579][26]))))"
And in MaskedEditExtender put MaskType="none".
Validate ok.
<asp:TextBox ID="TextBox5" runat="server" Width="130px" MaxLength="10" style="text-align:justify" ValidationGroup="MKE" Text="12-12-1999"></asp:TextBox>
I am wondering if you move the text to the actual text attribute, if that would make a difference... I don't have the most recent version of AjaxToolkit other wise I would try it my self... Oh I just noticed is your max length really set to one or is that a copy and paste error? That would cause problems too.