Showing posts with label tabbing. Show all posts
Showing posts with label tabbing. Show all posts

Saturday, March 24, 2012

Tabbing into a textbox with MaskedEditExtender

I am having an issue with the MaskedEditExtender in the Sept 20th ajaxtoolkit release. I have this textbox group:

<asp:Label ID="lblEffort2_KP" runat="server" Text="Y2 "></asp:Label>

<asp:TextBox ID="txtYear2Effort_KP" runat="server" CssClass="textbox" Width="50px" Text='<%# bind("effort_2") %>' TabIndex="5013"></asp:TextBox>
<ajaxToolkit:MaskedEditExtender ID="MEYear2Effort_KP" runat="server" TargetControlID="txtYear2Effort_KP"
InputDirection="RightToLeft" MaskType="Number" Mask="999.99%">
</ajaxToolkit:MaskedEditExtender>

You'll notice I have the inputdirection = right to left. If you tab into this textbox it highlights the mask and when you start entering the number it goes from LeftToRight.

You can see this error also on the microsoft ajax toolkit sample page.

Go here: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/MaskedEdit/MaskedEdit.aspx
and click on the text above the first textbox, the enter number one, and hit tab and you will see the issue. If you just click in the textbox it will work correctly, right to left. Any solution?

Hi Ryan,

I think it is a design pattern. When you press the tab and the cursor displays before the point. While you keep entering , the number will go to right from the left. If you have other suggestions, please post ithere. Also you can post your current idea to it. Our developers will evaluate them seriously and take them into consideration when designing future release of the product.Improving the quality of the products and services is a never-ending process for Microsoft.

Best regards,

Jonathan

Tabbing out of a textbox...

Just a word of warning - I am not very familiar with Ajax.

I have a few textboxes and a button within an update panel. When the button is clicked some data is retrieved (using Ajax) and some of the textboxes are filled with that data. I would like to remove the button click step, and instead have that data retrieved when the user leaves the first textbox. So, the user is in a name textbox. They type "Billy Bob," and then tab out to the next textbox (or click out of it to another textbox), at which time Ajax does it's asynchronous stuff to retrieve the data from the server for that name. Is this possible to do?

Thanks in advance!

You could try the TextChanged event of the first TextBox, remember to set theAutoPostBack value to true in the TextBox to generate a postback when you tab out of the TextBox.

hello guys,

yes, this will work, if you're using an updatepanel. anyway, it might not "feel right" to the user since the contents that are inside the panel will be refreshed (which meaans that he migh be writing something on another textbox and then when he looks at it, everything has been "replaced" by the contents sent from the server...


Absolutely right, I prefer to use WebServices or pagemethods to do something like this, infact I don't use UpdatePanels at all in my application for this (and other reasons.), but I think he is using an UpdatePanel at the moment.

Thank you both for your help. I was able to get it to work by using the textbox as the trigger.

Luis, I understand what you're saying about the workflow not feeling right. There are other underlying problems within this page (I didn't originally design it though!) and what it does that made me look at doing this as an option to fix some of those problems. But the more I look at it, the more I think that it just doesn't "feel right." =)

I probably won't implement this solution in the end. Thanks for the help!