How to Use MessageBox in ASP.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davidson1
    New Member
    • Feb 2008
    • 144

    How to Use MessageBox in ASP.NET

    Hai friends,

    I have a Textbox and submit button......

    Whenever any user enter above 50 , i should in message Box "You Should Enter Below 50"

    I dont know how to use (alert message in javascript) in asp.net....

    pl give coding......

    I dont want to use RangeValidator. ..

    give me in vb

    such as

    dim asdd as string

    Response.write( "Hai")

    Davidson

    Posted Date:- 2 March 2008

    Thank You............ ...
  • vanc
    Recognized Expert New Member
    • Mar 2007
    • 211

    #2
    Since this will be done at client side, you should use Javascript to take care of it. You will need to write a function to check for number of entered character in input(Text) control whenever it gets character and call alert function to display an alert that..... whatever you want to alert.
    I'll give you an dummy code, it's not working but it is the idea because I don't write Javascript :D

    //javascript function
    function DoIt()
    {
    if(document.for mname.inputname .value > 50)
    alert("Your alert is here");
    }
    <form name="formname" >
    <intput name="inputname " type="text"></input>
    </form>

    The document.formna me.inputname will return the input object, so you can anything with it. Hope you can work out the rest. Cheers.

    Comment

    • kunal pawar
      Contributor
      • Oct 2007
      • 297

      #3
      if(eval(documen t.formname.inpu tname.value) > 50)
      {
      // if more than 50 then your code;
      return true;
      }
      else
      {
      alert("Please enter value below 50");
      return false;
      }

      or

      if(eval(documen t.getElementByI d("inputname"). value) > 50)
      {
      // if more than 50 then your code;
      }
      else
      {
      alert("Please enter value below 50");
      document.getEle mentById("input name").focus();
      return false;
      }

      Comment

      Working...