UncleCoder.com

UncleCoder.com

Free programming examples and instructions

Asp.net - Calling server side events from html Button

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

by athilmp


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

Edited on 01 Jan 0001


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: