是如何应用它们的。声明事件代码如下:
/// <summary>
/// 获得本书更多内容,请看:
/// http://blog.csdn.net/ChengKing/archive/2008/08/18/2792440.aspx
/// </summary>
private new static readonly object EventPageIndexChanged = new object();
[Category("Action"), Description("翻页事件")]
public event GridPageChangedEventHandler PageIndexChanged
{
add
{
base.Events.AddHandler(Grid.EventPageIndexChanged, value);
}
remove
{
base.Events.RemoveHandler(Grid.EventPageIndexChanged, value);
}
}
宸戦写偬寡喘5.3.1弌准讐議互丼楕並周鹿栽双燕斤?base.Events?並周議兆各葎PageIndexChanged?溜熔窃侏葎岻念厘断協吶議溜熔窃侏GridPageChangedEventHandler。
哈窟並周議宰伉旗鷹泌和?
/// <summary>
/// 資誼云慕厚謹坪否,萩心:
/// http://blog.csdn.net/ChengKing/archive/2008/08/18/2792440.aspx
/// </summary>
protected override bool OnBubbleEvent(object source, EventArgs e)
{
bool handled = false;
if (e is GridCommandEventArgs)
{
if ((((GridCommandEventArgs)(e)).CommandSource) is LinkButton)
{
LinkButton lb=((LinkButton)(((GridCommandEventArgs)(e)). Command Source));
if (lb.CommandName == "Page")
{
if (lb.CommandArgument == "ButtonFirst")
{
GridPageChangedEventArgs ee = new GridPageChangedEventArgs();
if (this.CurrentPageIndex != 0)
{
this.CurrentPageIndex = 0;
ee.CurrentPageIndex = this.CurrentPageIndex;
ee.PageCount = this.PageCount;
ee.PageSize = this.PageSize;
this.OnPageIndexChanged(ee);
}
handled = true;
}
if (lb.CommandArgument == "ButtonNext")
{
GridPageChangedEventArgs ee = new GridPageChangedEventArgs();
if (this.CurrentPageIndex < this.PageCount - 1)
{
this.CurrentPageIndex += 1;
ee.CurrentPageIndex = this.CurrentPageIndex;
ee.PageCount = this.PageCount;
ee.PageSize = this.PageSize;
this.OnPageIndexChanged(ee);
}
handled = true;
}
if (lb.CommandArgument == "ButtonPrev")
{
GridPageChangedEventArgs ee = new GridPageChangedEventArgs();
if (this.CurrentPageIndex > 0)
{
this.CurrentPageIndex -= 1;
ee.CurrentPageIndex = this.CurrentPageIndex;
ee.PageCount =
|