Saturday, August 1, 2015

HTML control Event in ASP.net Code behind and Client Script

this is for HTML control event at client side script function

just copy the below code in source page of ur asp.net application

<html xmlns="http://www.w3.org/1999/xhtml" >
    <script language="VB" runat="server">
       Sub FancyBtn_Click(Source As Object, E as EventArgs)
          Message.InnerHtml = "Your name is: " & Name.Value
       End Sub
    </script>

    <head runat="server">
    <title> Enter Name: </title>
</head>
<body>
          <form id="form1" method="post" runat="server">

            <h3> Enter Name: <input id="Name" type="text" size="40" runat="server" />
            </h3>

             <button onserverclick=" FancyBtn_Click" runat="server">
               <b><i> I'm a fancy HTML 4.0 button </i> </b>
             </button>


           <h1>
             <span id="Message" runat="server"></span>
           </h1>

          </form>
       </body>
 </html>




---------------------------------------------------------

this is for HTML control event at server side code behind function

just copy the below code in view code of ur asp.net application
   Sub FancyBtn_Click(Source As Object, E as EventArgs)
          Message.InnerHtml = "Your name is: " & Name.Value
       End Sub


but comment the  below code in htmlsource view
/*<script language="VB" runat="server">
       Sub FancyBtn_Click(Source As Object, E as EventArgs)
          Message.InnerHtml = "Your name is: " & Name.Value
       End Sub
    </script>*/

 

24 comments:

subha said...

thank you mam.so kind of you.

Unknown said...

It is very useful Mam

Unknown said...

this code is very useful to us ...

Anonymous said...

i have done this mam

Unknown said...

i got the output mam!

LDCMSCIT said...

i got result mam

Unknown said...
This comment has been removed by the author.
LDCMSCIT said...

i got output mam
by, angel

Aishu said...

we have got the o/p successfully mam.thank you mam.

Unknown said...

Thanks for the code mam.IT is working.

Unknown said...

i executed this mam!!!

Unknown said...

Can u give me a detailed explanation on the script tag mam......

Unknown said...

It's very useful.Thank you mam!

Unknown said...

i have done it

Unknown said...

I tried this program.and i got the output mam.

Unknown said...

Mam,I've Worked on this Code.Your Blog is very useful to workout....

Unknown said...

i got d output mam.

Unknown said...

i got output mam!!!Thank you mam its very useful to us!!!

Unknown said...

thank u mam

Unknown said...

i have done it

Unknown said...

i hav done this program. its working mam...

Hasini said...

The Script tag can be teach on later on classes in detail.....

Thanks for all of ur comments

Hasini said...

Your Queries are most welcome.........

Unknown said...

I too tried ..was very useful..
Tq so much Mam... :)