This is a migrated thread and some comments may be shown as answers.

RadInput - automatic postback after reaching maxlength

1 Answer 65 Views
Input
This is a migrated thread and some comments may be shown as answers.
Roel
Top achievements
Rank 1
Roel asked on 01 Aug 2008, 07:41 AM

Hi,

Is there a way to have a client-side postback when the input in a textbox reaches the maximum length?

The input is generated by a bar-code scan, but unfortunately the scanner can't be configured to trigger a carriage return after input.

Thanks,
Roel

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Aug 2008, 11:54 AM
Hi Roel,

You can try the following code snippet to achieve the desired scenario.

ASPX:
<telerik:RadTextBox ID="RadTextBox1"  runat="server" Width="640px"   ClientEvents-OnKeyPress ="test" > 
        </telerik:RadTextBox> 

JS:
<script type="text/javascript"
function test() 
 var maxLength = 5
 var txt=document.getElementById("<%= RadTextBox1.ClientID %>"); 
 if(txt.value.length==maxLength) 
  { 
 
     __doPostBack("<%= RadGrid1.ClientID %>"); 
   } 
</script> 


Hope this helps
Shinu.
Tags
Input
Asked by
Roel
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or