Repeater.OnBubbleEvent Method
.NET Framework 2.0
This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Raises the ItemCommand event if the EventArgs parameter is an instance of RepeaterCommandEventArgs.
Namespace: System.Web.UI.WebControlsAssembly: System.Web (in system.web.dll)
protected boolean OnBubbleEvent ( Object sender, EventArgs e )
protected override function OnBubbleEvent ( sender : Object, e : EventArgs ) : boolean
Parameters
- sender
The source of the event.
- e
An EventArgs object that contains the event data.
Return Value
true if the ItemCommand was raised, otherwise false.The following code example demonstrates how to override the OnDataBinding method in a custom server control so that if the event argument is a command type, the Repeater control always calls the OnItemCommand and bubbles up the event, or returns false and cancels the event.
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<HTML>
<HEAD>
<title>Custom Repeater - OnBubbleEvent - VJ# Example</title>
<script language="VJ#" runat="server">
void Page_Load(Object Sender, EventArgs e)
{
if (!get_IsPostBack()) {
ArrayList values = new ArrayList();
values.Add(new PositionData("Microsoft", "Msft"));
values.Add(new PositionData("Intel", "Intc"));
values.Add(new PositionData("Dell", "Dell"));
Repeater1.set_DataSource(values);
Repeater1.DataBind();
}
} //Page_Load
public class PositionData
{
private String name;
private String ticker;
public PositionData(String name, String ticker)
{
this.name = name;
this.ticker = ticker;
} //PositionData
/** @property
*/
public String get_Name()
{
return name;
} //get_Name
/** @property
*/
public String get_Ticker()
{
return ticker;
} //get_Ticker
} //PositionData
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom Repeater - OnBubbleEvent - VJ# Example</h3>
<aspSample:CustomRepeaterOnBubbleEvent id="Repeater1" runat="server">
<HeaderTemplate>
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th>Company</th>
<th>Symbol</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td> <%# DataBinder.Eval(Container.get_DataItem(), "Name") %></td>
<td> <%# DataBinder.Eval(Container.get_DataItem(), "Ticker") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</aspSample:CustomRepeaterOnBubbleEvent>
</form>
</body>
</HTML>
package Samples.AspNet.JSL.Controls;
public class CustomRepeaterOnBubbleEvent
extends System.Web.UI.WebControls.Repeater
{
protected boolean OnBubbleEvent(Object source, System.EventArgs args)
{
// If the EventArgs are of type RepeaterCommandEventArgs,
// then call the OnItemCommand event handler and return true
// (bubble up the event)
// else return false (don't bubble up the event).
boolean isHandled = false;
if (args instanceof System.Web.UI.WebControls.
RepeaterCommandEventArgs) {
this.OnItemCommand((System.Web.UI.WebControls.
RepeaterCommandEventArgs)args);
isHandled = true;
}
return isHandled;
} //OnBubbleEvent
} //CustomRepeaterOnBubbleEvent
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
ADD
Show: