Search code examples
c#asp.netajaxajaxcontroltoolkitmaskededitextender

Cursor position in ajax MaskedEditExtender upon user click (ASP.net C#)


My textbox has MaskedEditExtender, but the problem is that when user clicks on the textbox, the cursor is positioned at end (right side) rather than the left side begning. Can someone help? There were some solution to have a java script function on onfocus, but ASP.net text does not have onfoucs event to be set.

<asp:TextBox ID="TextBox5" runat="server" CssClass="MainContent" ValidationGroup="MKE" Width="180px" />
                                        <asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server"
                                            AcceptNegative="Left"  MaskType="Date" DisplayMoney="Left" ErrorTooltipEnabled="True" 
                                            mask="9999/99/99" MessageValidatorTip="true"  InputDirection="RightToLeft" CultureName="sv-SE" 
                                            OnFocusCssClass="MainContent" OnInvalidCssClass="MainContent" 
                                            TargetControlID="TextBox5"   />

Solution

  • I think the problem comes from the property InputDirection... Try

    InputDirection="LeftToRight"