UncleCoder.com

UncleCoder.com

Free programming examples and instructions

Calling server side function from html Button - Asp.net

Demo and code for how to call server function from html button in Asp.net

by Athil


Posted on 01 Jan 0001 Category: Asp.net Views: 7231


Here I am going to show how to call server side functions from HTML button.
By giving runat="server" onserverclick ="MyFunction" to HTML button we can call server  side events from html button

DEMO

DOWNLOAD DEMO

In client side

<form id="form1" runat="server">
    <div>
        
          <input id="Submit1" runat="server" onserverclick ="MyFunction" type="submit" value="Click Me" />    
    </div>      
    </form>


In Server Side 

public void MyFunction(object sender, EventArgs e)
        {
            Response.Write("Hello");
        }

 



Leave a Comment:


Click here to register

Popular articles