How to restrict the postback after reaching maxvalue of Radnumeric textbox

3 posts, 1 answers
  1. suresh
    suresh avatar
    30 posts
    Member since:
    Apr 2011

    Posted 16 Feb 2012 Link to this post

    HI there,
    How to restrict the postback when we click upper arrow in the numeric textbox after reaching the maxvalue?? or Is it possible to disable the upper arrow after reaching maxvalue.??..I am aware of textbox doesn't allow the value that exceeding maxvalue.
    Here is my code ,
    <telerik:RadNumericTextBox ID="tbDays" AutoPostBack="true"  MaxValue="50"
            runat="server" ontextchanged="tbDays_TextChanged">
            <NumberFormat DecimalDigits="0" />
        </telerik:RadNumericTextBox>
    On server side:
    protected void tbDays_TextChanged(object sender, EventArgs e)
        {
           int itemCount = int.Parse(tbDays.Text);
           ///Doing Some stuff..
        }
    Thanks in advance..
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Feb 2012 Link to this post

    Hello Suresh,

    Try the following javascript.
    JS:
    function OnLoad(sender, args)
    {
     if (sender.get_maxValue() == 50)
      {
       sender.set_autoPostBack(false);
      }
    }

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. suresh
    suresh avatar
    30 posts
    Member since:
    Apr 2011

    Posted 16 Feb 2012 Link to this post

    Thanks shinu..Its working perfectly..
Back to Top