开发者

ASPxTextbox - masking, prompt always at last or first character

I have an aspxtextbox e.g

  <dxe:ASPxTextBox ID="txtZip" runat="server" Width="150">
                            <MaskSettings Mask="00000" ErrorText="Please input missing symbols" />
                            <ValidationSettings ErrorDisplayMode="ImageWithTooltip" />
        开发者_开发问答                </dxe:ASPxTextBox>

How can I modify it so that when the user goes to the textbox, it will always position the cursor at index 0, or the last entered character?

Thanks,

Jacob


This can be done by handling the editor's client side GotFocus event handler. Here is some sample code:

<dxe:ASPxTextBox ID="txtZip" runat="server" Width="150">
                    <MaskSettings Mask="00000" ErrorText="Please input missing symbols" />
                    <ValidationSettings ErrorDisplayMode="ImageWithTooltip" />
                    <ClientSideEvents GotFocus="
                    function(s,e) {
                        var editorValue = s.GetValue();
                        if(editorValue)
                            s.SetCaretPosition(editorValue.toString().length);
                    }" />
                </dxe:ASPxTextBox>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜