AJAXControlToolkit MaskedEditExtender behavior - asp.net

I am referencing the latest AJAXControlToolkit in my ASP.Net 4.0.xxx WebForm application. I am using the extender to format a phone number field as follows. If the field is left empty then I don't need any mask showing up. But if the phone number is entered then I don't want the mask to disappear when tabbed away from that field, but this is exactly whats happening. The hyphens in the mask disappear and only numbers are left in the field. How can I prevent this from happening?
<asp:TextBox ID="Contact_HomePhone" runat="server" MaxLength="50"></asp:TextBox>
<ajaxToolkit:MaskedEditExtender
Mask="999-999-9999" MaskType="Number" ClearMaskOnLostFocus="True"
ID="Contact_HomePhone_MaskedEditExtender" runat="server" TargetControlID="Contact_HomePhone" />
Thanks.

I am going with jQuery MaskedInput code and it is working exactly as I wanted and even more.
Thanks for all the feedback!

Related

Sharepoint FormField default value?

Is it possible to add default values to a sharepoint FormField object?
Here is my code:
<SharePoint:formfield runat="server" id="ff8{$Pos}" ControlMode="Edit" FieldName="Body" ItemId="{#ID}" __designer:bind="{ddwrt:DataBind('u',concat('ff8',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(#ID)),'#Body')}" />
<SharePoint:fielddescription runat="server" id="ff8description{$Pos}" FieldName="Body" ControlMode="Edit" />
Basically, I want the form field's default value to be more than just the Body parameter (perhaps 2 parameters and some custom text). Is this possible?
(Also, I know you can substitute the SP form Field with an ASP TextBox, but I'm running into problems with that--specifically, the text box doesn't support rich text, and the post-back doesn't preserve line breaks.)
Thanks in advance!
It looks like I was able to solve this. Other forums had me using an ASP Text box and writing code behind in C#, but it's really not necessary if you use a Sharepoint:InputFormTextBox instead.
<SharePoint:InputFormTextBox ID="ff8{$Pos}" RichText="true" text="{concat(#Body, "CustomText", #secondparameter)}" RichTextMode="FullHtml" TextMode="MultiLine" runat="server" __designer:bind="{ddwrt:DataBind('u',concat('ff8',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(#ID)),'#Body')}" Width="99%" Rows="10"/>
If this was an obvious solution, please forgive my ignorance. This is new territory for me.

FireFox and AjaxControlToolKit Combobox

I'm using the .NET framework 4.0 and the corresponding version of the Ajax control toolkit.
On my page I have a combobox defined like this:
<asp:ComboBox ID="cbUserName" AutoCompleteMode="SuggestAppend"
CaseSensitive="false" runat="server" BackColor="#FFFFCC">
</asp:ComboBox>
In IE9 the combobox allows me to either type in it or select from the list of users. In FireFox, however, it's not letting me type in the box. The dropdownlist also doesn't filter when I'm typing in FireFox either. I'm wondering if anyone else has seen this behavior, and if there's a work-around?
EDIT
For what it's worth, the demo on the ASP.NET Ajax Control Toolkit site actually works fine in FireFox.
I was also getting the problem of not being able to enter text into a Combobox in FireFox, but I could in IE and Chrome. After a day of looking into the problem I found that setting the MaxLength property to something greater than 0 allowed FireFox to accept entry in the text field for the combobox.
I hope this helps someone having the same problem.
ddlBox.SelectedIndex = 0
Until the latest iteration of Ajax control toolkit, I didn't need to set that. But then I updated, and I couldn't type into the empty text box, which used to be displayed with the first item. So I added that code and it works fine again.
The similar issue has been reported here, make sure you used the same version of firefox and toolkit. If not try to upgrade them and again try.
<ajaxToolkit:ComboBox ID="ComboBox1" runat="server" DropDownStyle="DropDownList" AutoCompleteMode="SuggestAppend" CssClass="" AppendDataBoundItems="false">
<asp:ListItem>Fox</asp:ListItem>
</ajaxToolkit:ComboBox>
This worked for me in firefox.
Im not sure if you mistaking the ability to type but a combobox will only allow you to type out the ListItems. so in this case it will only allow you to type out Fox..
I experienced the same problem. I couldn't find an elegant solution online so I built my own AjaxControlToolkit.dll from two different sets of the toolkit source code.
I used everything from the latest release except for I replaced ComboBox.cs and ComboBox.pre.js with their versions from AjaxControlToolkit_8502f32ba9ce. (~July 2011)
Try using:
ajaxToolkit:ComboBox ID="ComboBox1" runat="server" DropDownStyle="DropDownList"
AutoCompleteMode="SuggestAppend" CssClass="" AppendDataBoundItems="false"
MaxLength="100"

ASP.Net PasswordStrength Control Display Issues in Chrome and Safari

First off, jQuery is not an option at this particular time in this project or I would just utilize that type of password strength option.
Currently I have an Ajax control toolkit control (PasswordStrength) setup to work with a textbox. The control is inside the table row/cell next to the textbox itself in which it validates. It is also setup to be a bar-type indicator that is displayed on the Right side of the textbox through the DisplayPosition property.
The strength meter appears fine in IE, Firefox and Opera ... Right next to the password field textbox and this is great. Now, in Chrome and Safari, the indicator appears at a random place on the page and if you continue typing the indicator actually moves up and down the page randomly, nowhere close to the right side of the password textbox. The indicator is technically correct on the x-axis, meaning it is "beside" the textbox, but the y-axis is sporadic and moves up and down the page, nowhere near the textbox. The behavior is the same in Chrome and Safari.
Any ideas? It's making me a bit nutty as I've tried wrapping divs, positioning, moving the control, adjusting properties etc.
Any help is greatly appreciated.
Here is the textbox and control itself as it is currently setup:
<asp:TextBox ID="txtPassword" Width="150px" runat="server"
Style="text-align: left" TextMode="Password" </asp:TextBox>
<asp:PasswordStrength ID="PS1"
runat="server"
TargetControlID="txtPassword"
DisplayPosition="RightSide"
StrengthIndicatorType="BarIndicator"
PreferredPasswordLength="16"
MinimumNumericCharacters="1"
MinimumSymbolCharacters="1"
MinimumLowerCaseCharacters="1"
MinimumUpperCaseCharacters="1"
RequiresUpperAndLowerCaseCharacters="false"
CalculationWeightings="50;15;15;20"
TextStrengthDescriptionStyles="barRed;barYellow;barBlue;barGreen"
Enabled="true"
BarBorderCssClass="barBorder"
BarIndicatorCssClass="barInternal">
</asp:PasswordStrength>
Any help or suggestions would be greatly appreciated!

AjaxControlToolkit Calendar postioning relative to popup image and not the textbox

Hi I am using an AjaxControlToolkit Calander control. But as per my requirements I have to split the selected date into separate textboxes for date month and year. So I have used a textbox say "textbox1" which have an popupimage button for the ajax control calander.
I make the textBox1 hidden with css and have autopostback set to true. On the text change event I split the date string and put it in separate textboxes as desired.
Everything is working fine except for the positioning of the Calander control. When I hide the main textbox control the calander positions itself on the top left side of the screen and not near the popimage. How can I fix that.
It will surely have an abnormal behavior if you try to attach a calendar control on a hidden TextBox. Instead of hiding the textbox, make it look like hidden but not literally hidden.
for example
<asp:TextBox ID="textBox1" runat="server" style="border:0 none Transparent;margin:0;width:0;background-color:Transparent" ReadOnly="true" />
Thanks to the answer above just a slight modification is needed to make it the correct answer.
<asp:TextBox ID="textBox1" runat="server" style="border:0 none Transparent;margin:0;width:0;background-color:Transparent" />

Calendar control is not popping-up when clicked on image

I'm using a CalendarExtender control with the help of <img> to populate a TextBox with a date. I am using this in EditItemTemplate of GridView. But when I click on the image, the calendar control is not poping up.
I have used this CalendarExtender control in four or five other places (in this project) also. Everywhere else it is working fine. I have compared the code from the well working version to this code. No difference at all.
I have written the code like below:
<EditItemTemplate>
<asp:TextBox ID="txtDateDelivered" runat="server"
Text='<%# Bind("DateDelivered","{0:dd/MM/yy}") %>'
CssClass="DateTextBoxInGridView" >
</asp:TextBox>
<asp:CalendarExtender ID="calexDateDelivered" runat="server"
Format="dd/MM/yy"
TargetControlID="txtDateDelivered"
PopupButtonID="calDateDelivered">
</asp:CalendarExtender>
<img src="Images/calendar.gif"
id="calDateDelivered"
alt="Calendar" />
</EditItemTemplate>
Can anybody please tell where could be the problem?
how many row do you have in grid? also probably you have more than one image with such id
The image tag which you have used is not a server control.
It is simple html control, this is the reason why the calender control does not reconise this image control..
Try using asp.net image button over here instead of .
It should work then.
cheers....
Rahul C.

Resources