UncleCoder.com

UncleCoder.com

Free programming examples and instructions

Calling server side events from html Button - Asp.net

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

by Athil


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

Edited on 28 Jun 2019


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

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: