Click event example

This example shows you how to display the string "Hello world!" in a specific label. The display of the string is due to the event raised when the button is clicked.

 

<%@ Page Language="Eiffel" Description="Eiffel ASP.NET example" %>

<script runat=server>
   feature -- Basic Operation
	button_click (source: SYSTEM_OBJECT; e: EVENT_ARGS) is
		-- button click
	    do
		my_lbl.set_Text (("Hello world!").to_cil)
	    end
</script>

<html>
    <body>
	<form runat=server>
	    <asp:Button id=Button1 text="Click me" OnClick="button_click" runat=server />
<br> <asp:Label runat=server text="" id=my_lbl /> </form runat=server> </body> <html>

 

Here is the output:

 

[run the example]