我正在尝试扩展我们的 Gridview 的 Paging 属性,以允许用户通过单击相应的文本链接来选择他们希望每页看到多少项目;即 25 | 50 | 75 | 100. page属性在后面的代码中设置如下:
/// <summary>
/// Gets or sets the number of items displayed on a result page.
/// </summary>
#region PageSize;
[Bindable(true),
Category("Paging"),
Description("Paging Size"),
NotifyParentProperty(true)]
public virtual int PageSize
{
get
{
return (ViewState["PageSize"] == null) ? 25 : (int)ViewState["PageSize"];
}
set
{
//return ((int)ViewState["LastPage"]);
ViewState["PageSize"] = value;
}
}
这些事件是:
/// <exclude/>
/// <summary>
/// Click event on '25' paging text link
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
protected virtual void PageSize25_Click(object sender, EventArgs e)
{
// ToDo: Pass new page size 25 to click event
// Bind data to new page size
// ViewState["PageSize"] = 25;
}
/// <exclude/>
/// <summary>
/// Click event on '50' paging text link
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
protected virtual void PageSize50_Click(object sender, EventArgs e)
{
// ToDo: Pass new page size 50 to click event
// Bind data to new page size
// ViewState["PageSize"] = 50;
}
/// <exclude/>
/// <summary>
/// Click event on '75' paging text link
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
protected virtual void PageSize75_Click(object sender, EventArgs e)
{
// ToDo: Pass new page size 75 to click event
// Bind data to new page size
}
/// <exclude/>
/// <summary>
/// Click event on '100' paging text link
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">EventArgs</param>
protected virtual void PageSize100_Click(object sender, EventArgs e)
{
// ToDo: Pass new page size 100 to click event
// Bind data to new page size
}
我不知何故需要将每个文本链接的值 (25 | 50 | 75 | 100) 传递给 PageSize 属性。
谢谢。任何帮助将不胜感激。