Control
User-defined controls in ASP.net feature 1: Implement take; 2: Easy to create (relative to component). The following is a pagination navigation bar of sample, received in Webdiyer, I believe many people have been thunderclap piercing, I do not introduce more. This question is just a simple exercise, with no esoteric algorithms or architectures.
Namespace Gallonkit
{
Using System;
Using System.Data;
Using System.Drawing;
Using System.Web;
Using System.Web.UI.WebControls;
Using System.Web.UI.HtmlControls;
<summary>
Summary description of the Pagebar.
</summary>
Public UINT PageIndex
{
get{
if (this. Isuint (This.tb_pageIndex.Text.Trim ()))
return UINT. Parse (This.tb_pageIndex.Text.Trim ());
return 0;
}
set{
if (this. Isuint (value. ToString ()))
This.tb_pageIndex.Text = value. ToString ();
Else
throw new System.Exception ("the page range is not correct!") ");
}
}
Public UINT PageCount
{
Get
{
Object obj = viewstate["pagecount__"];
return (obj = null)? 0: (UINT) obj;
}
Set
{
if (this. Isuint (value. ToString ()))
{
This.lb_PageCount.Text = value. ToString ();
viewstate["pagecount__"] = value;
}
Else
throw new System.Exception ("the page range is not correct!") ");
}
}
Code generated #region the Web forms Designer
Override protected void OnInit (EventArgs e)
{
//
CodeGen: This call is required for the ASP.net Web forms Designer.
//
InitializeComponent ();
Base. OnInit (e);
}
<summary>
Designer supports the desired method-do not use the Code Editor
Modify the contents of this method.
</summary>
private void InitializeComponent ()
{
This.btn_fistPage.Click + = new System.EventHandler (This.btn_fistpage_click);
This.btn_prePage.Click + = new System.EventHandler (This.btn_prepage_click);
This.btn_nextPage.Click + = new System.EventHandler (This.btn_nextpage_click);
This.btn_lastPage.Click + = new System.EventHandler (This.btn_lastpage_click);
This.btn_local. Click + + new System.EventHandler (This.btn_local_click);
This. Load + = new System.EventHandler (this. Page_Load);
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service