0

How to get the length of textbox?

For example :

<dx:ASPxTextBox ID="textbox_ID" runat="server" Height="16px" Width="83px" 
                ClientInstanceName="textbox_ID" AutoPostBack="false">
    <ClientSideEvents LostFocus="function(s,e){
        if(textbox_ID.GetText().Length==3){
            alert(textbox_ID.GetText());
        }
    }" />
</dx:ASPxTextBox>

Thank you.

Stoyan Dimov
  • 5,250
  • 2
  • 28
  • 44

1 Answers1

0

DevExpress ASPxTextbox GetText() returns a JavaScript string therefore you can simply access it's length like you would in any other JS string:

...
    if(textbox_ID.GetText().length==3){
...
andrews
  • 2,173
  • 2
  • 16
  • 29
  • Thank you Andrews. Your solution is useful. :) – Timothy Varian Feb 14 '17 at 10:20
  • @TimothyVarian I'm glad it helped but in the future, try to do your own research using google, w3chools.com etc because trivial questions are NOT welcomed on this site and people will very likely start down-voting them thus you will lose your reputation. When you get 15 rep you will also be able to up vote other questions and answers, so losing rep is not helpful even if you don't care about it. Hope this helps ;). – andrews Feb 14 '17 at 10:27