Roll-Over Button Server Control Demo

This demo illustrates the roll-over button server control. Note that when the button is clicked, it causes the Web Form to postback. Both roll-over buttons have their Command event wired up to the rollover_command event handler, which displays in the Label Web control below what button was clicked...


Click a RollOver button to cause a postback...


Source Code
<%@ Register TagPrefix="cc1" Namespace="RolloverButton" Assembly="RolloverButton" %>
<script language="C#" runat="Server">
	void rollover_command(object sender, CommandEventArgs e)
	{
		results.Text = "You clicked: " + e.CommandName;
	}
</script>

<form id="Form1" method="post" runat="server">
	<cc1:rollover CommandName="Home" OnCommand="rollover_command" 
	       runat="server" id="RollOver1" ImageUrl="/images/home.gif" 
	       RollOverImageUrl="/images/home_over.gif" ToolTip="Home Alone!"></cc1:rollover>
	<cc1:rollover CommandName="FAQs" OnCommand="rollover_command" 
	       id="RollOver2" runat="server" ImageUrl="/images/faqs.gif" 
	       RollOverImageUrl="/images/faqs_over.gif"></cc1:rollover>
	<p>
	<asp:label runat="server" id="results">Click a RollOver button to cause a postback...</asp:label>
</form>

[Return to the article]