Page view counter

Onleave event for a textbox

Last post 11-20-2008 11:46 PM by yeotumitsu@sify.com. 5 replies.

Sort Posts:

  • Onleave event for a textbox

    11-20-2008, 2:47 AM
    • Loading...
    • Bhagavatula
    • Joined on 11-20-2008, 7:30 AM
    • AndhraPradesh, India
    • Posts 31
    • Points 90

    I have a javascript for phone number checking.But I dont know where to use this script in asp.net textbox control.Please help me.

    thanks in advance.

     

    please mark it as answer, if it helps you............
  • Re: Onleave event for a textbox

    11-20-2008, 5:17 AM
    Answer

     Use OnBlur event.

    <script type="text/javascript">
    function yourFun()
    {
       
    }
    </script>

    =======================================

    <asp:TextBox .......   onBlur="yourFun();"

    or

    TextBox1.Attributes.Add("onBlur","return yourFun();");

    Hope it helps.

    -Manas

    =======================================
    If this post is useful to you, please mark it as answer.
  • Re: Onleave event for a textbox

    11-20-2008, 5:22 AM
    Answer
    • Loading...
    • mohammednu
    • Joined on 10-23-2008, 12:13 PM
    • Chennai, India
    • Posts 27
    • Points 154

    For adding Client Events in ASP control you can add an attribute

     
    HTML:

     
    <body>
    <script language="jscript" type="text/jscript">
    function test()
    {
    alert ("hai");
    }
    </script>
        <form id="form1" runat="server">
        <div>
        <asp:TextBox ID="txtTest" runat="server" text="Click Here"></asp:TextBox>
        </div>
        </form>
    </body>
    </html>

     

    C# :

             protected void Page_Load(object sender, EventArgs e)
            {
                if ( !IsPostBack )
                    txtTest.Attributes.Add( "onclick", "test()" );
            }

     

    If this does not help you please explain your scenario ... may be try to paste some code too....

    Bye.

     
    If this resolves your issue please mark this post as answered as it will let others know that this post is closed. 

     

  • Re: Onleave event for a textbox

    11-20-2008, 8:11 AM
    • Loading...
    • Bhagavatula
    • Joined on 11-20-2008, 7:30 AM
    • AndhraPradesh, India
    • Posts 31
    • Points 90

    Yah....! Its workingBig Smile

    thanq verymuch, sir.

    please mark it as answer, if it helps you............
  • Re: Onleave event for a textbox

    11-20-2008, 11:38 PM
    • Loading...
    • Bhagavatula
    • Joined on 11-20-2008, 7:30 AM
    • AndhraPradesh, India
    • Posts 31
    • Points 90

    yeotumitsu@sify.com:

     Use OnBlur event.

    <script type="text/javascript">
    function yourFun()
    {
       
    }
    </script>

    =======================================

    <asp:TextBox .......   onBlur="yourFun();"

    or

    TextBox1.Attributes.Add("onBlur","return yourFun();");

    I am new to this forum and ur answer is very helpful to me.

    but, where can I mark it as Answer.?

    please mark it as answer, if it helps you............
  • Re: Onleave event for a textbox

    11-20-2008, 11:46 PM

     Well... look the extreme right part in the title of the post you wish to mark as answer.

     You have a option there.

    Hope it helps.

    -Manas

    =======================================
    If this post is useful to you, please mark it as answer.
Page 1 of 1 (6 items)