1、自己定义控件本身
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
using System.Web.UI;
5
using System.Web.UI.WebControls;
6
using System.Web.UI.HtmlControls;
7
using System.Drawing;
8
using System.Collections;
9
using System.Collections.Specialized;
10
using System.ComponentModel;
11
using System.Data;
12![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
13
using Gentle.Framework;
14![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**//// -----------------------------------------------------------------------------
15
/// Project : CtrolBox
16
/// Class : PagerCtl///
17
/// -----------------------------------------------------------------------------
18
/// <summary>
19
/// gentle分页
20
/// </summary>
21
/// <remarks>
22
/// </remarks>
23
/// <history>
24
/// xx. YYYY/MM/DD VER AUTHOR COMMENTS
25
/// 1. 2007/2/2 1.00 susan CREATE
26
/// </history>
27
/// ----------------------------------------------------------------------------- 28![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
29
namespace CtrolBox
30![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
31
[assembly: WebResource(CtrolBox.PagerCtl.CSSResName, "text/css")]
32
[assembly: WebResource(CtrolBox.PagerCtl.JSResName, "text/javascript")]
33![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
34
public class PagerCtl: WebControl, INamingContainer, IPostBackDataHandler
35![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
36![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
内部属性#region 内部属性
37![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
38
public const string CSSResName = "CtrolBox.Calendar.css";
39
public const string JSResName = "CtrolBox.Calendar.js";
40
static string strCssLink;
41
static string strJsLink;
42![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
43
private TextBox _EditBox = new TextBox();
44
private Label _strCount = new Label();
45
private DataTable _DataSource = new DataTable();
46
private int _PageSize = 10;
47![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
48
#endregion
49![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
50![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
属性#region 属性
51![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
52
[Bindable(true),
53
Category("Appearance"),
54
DefaultValue("0"),
55
Description("每页资料数")]
56
public int PageSize
57![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
58
get
59![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
60
return _PageSize;
61
}
62
set
63![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
64
_PageSize = value;
65
}
66
}
67![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
68
[Bindable(true),
69
Category("Appearance"),
70
DefaultValue(""),
71
Description("显示框的值")]
72
public string PageValue
73![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
74
get
75![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
76
return _EditBox.Text;
77
}
78
set
79![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
80
_EditBox.Text = value;
81
}
82
}
83![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
84
[Bindable(true),
85
Category("Appearance"),
86
DefaultValue(""),
87
Description("sql")]
88
public string Sql
89![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
90
get
91![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
92
if (ViewState["Sql"] == null)
93
return string.Empty;
94
return Convert.ToString(ViewState["Sql"]);
95![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
96
}
97
set
98![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
99
ViewState["Sql"] = value;
100
setPageload();
101
}
102
}
103![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
104
[Bindable(true),
105
Category("Appearance"),
106
DefaultValue(""),
107
Description("取得信息值")]
108
public DataTable DataSource
109![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
110
get
111![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
112
return _DataSource;
113
}
114
}
115![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
116
#endregion
117![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
118![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
公开事件#region 公开事件
119![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
120
[Bindable(true),
121
Category("Appearance"),
122
DefaultValue(""),
123
Description("事件")]
124
public event System.EventHandler btnClick;
125![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
126![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
127
/// 第一页
128
/// </summary>
129
/// <param name="Sender"></param>
130
/// <param name="e"></param>
131
public void First_Click(Object Sender, EventArgs e)
132![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
133
this._EditBox.Text = "1";
134
btn_Click(Sender, e);
135
}
136![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
137![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
138
/// 下一面
139
/// </summary>
140
/// <param name="Sender"></param>
141
/// <param name="e"></param>
142
public void Next_Click(Object Sender, EventArgs e)
143![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
144
this._EditBox.Text = Convert.ToString(Convert.ToInt32(this._EditBox.Text) + 1);
145
btn_Click(Sender, e);
146
}
147![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
148![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
149
/// 上一页
150
/// </summary>
151
/// <param name="Sender"></param>
152
/// <param name="e"></param>
153
public void Pre_Click(Object Sender, EventArgs e)
154![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
155
this._EditBox.Text = Convert.ToString(Convert.ToInt32(this._EditBox.Text) - 1);
156
btn_Click(Sender, e);
157
}
158![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
159![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
160
/// 最后一页
161
/// </summary>
162
/// <param name="Sender"></param>
163
/// <param name="e"></param>
164
public void Last_Click(Object Sender, EventArgs e)
165![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
166
this._EditBox.Text = fn_getPages();
167
btn_Click(Sender, e);
168
}
169![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
170![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
171
/// 到何页
172
/// </summary>
173
/// <param name="Sender"></param>
174
/// <param name="e"></param>
175
public void btn_Click(Object Sender, EventArgs e)
176![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
177
GentleSqlFactory sqlfact = Broker.GetSqlFactory();
178
IDbCommand cmd = sqlfact.GetCommand();
179![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
180
SqlStatement st = null;
181
SqlResult sr = null;
182
if (this._EditBox.Text.Trim() != "")
183![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
184
st = new SqlStatement(Gentle.Framework.StatementType.Select, cmd, ViewState["Sql"].ToString(), this._PageSize, this._PageSize * (Convert.ToInt32(this._EditBox.Text.Trim()) - 1));
185
sr = st.Page(Convert.ToInt32(this._EditBox.Text.Trim()));
186
}
187
else
188![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
189
st = new SqlStatement(Gentle.Framework.StatementType.Select, cmd, ViewState["Sql"].ToString(), this._PageSize, this._PageSize * 0);
190
sr = st.Page(1);
191
}
192
this._DataSource = ObjectView.GetDataView(sr).Table;
193
//加载事件
194
if (btnClick != null)
195
btnClick(this, e);
196
}
197![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
198
#endregion
199![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
200![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
内部function#region 内部function
201![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
202![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
203
/// 初始化数据源
204
/// </summary>
205
private void setPageload()
206![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
207![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
208
GentleSqlFactory sqlfact = Broker.GetSqlFactory();
209
IDbCommand cmd = sqlfact.GetCommand();
210![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
211
SqlStatement st = new SqlStatement(Gentle.Framework.StatementType.Select, cmd, ViewState["Sql"].ToString(), this._PageSize, this._PageSize * 0);
212
SqlResult sr = st.Page(1);
213
this._DataSource = ObjectView.GetDataView(sr).Table;
214
this._EditBox.Text = "1";
215
ViewState["PageCount"] = fn_getPages();
216
this._strCount.Text = ViewState["PageCount"].ToString();
217
}
218![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
219
/// 取到总页数
220
/// </summary>
221
/// <returns></returns>
222
private string fn_getPages()
223![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
224
int rows = Broker.Execute(ViewState["Sql"].ToString()).Rows.Count;
225
string pagecount = Convert.ToString((rows / this.PageSize) + ((rows % this.PageSize) == 0 ? 0 : 1));
226
return pagecount;
227
}
228![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
229
#endregion
230![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
231![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
实现#region 实现
232![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
233![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
234
/// 定义控件内容
235
/// </summary>
236
protected override void CreateChildControls()
237![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
238
try
239![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
240
this.Controls.Clear();
241![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
242![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
加载控件#region 加载控件
243![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**////转新页
244
this.Controls.Add(new LiteralControl("第"));
245
this._EditBox.ID = "EditBox";
246
this._EditBox.CssClass = "textbox";
247
this._EditBox.Columns = 2;
248
this._EditBox.EnableViewState = false;
249
this.Controls.Add(this._EditBox);
250
this.Controls.Add(new LiteralControl("页/共"));
251![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**////
252
if (ViewState["PageCount"] != null)
253
this._strCount.Text = ViewState["PageCount"].ToString();
254
this.Controls.Add(_strCount);
255
this.Controls.Add(new LiteralControl("页"));
256
//加入操作button
257
Button btnGo = new Button();
258
btnGo.ID = "btnGo";
259
btnGo.CssClass = "button";
260
btnGo.Text = "Go";
261
btnGo.OnClientClick = "javascript:if(fn_Check(document.all." + _EditBox.ClientID + ",'" + this._strCount.Text.Trim() + "','G')==false) return false;";
262
btnGo.Click += new EventHandler(btn_Click);
263
this.Controls.Add(btnGo);
264
this.Controls.Add(new LiteralControl(" "));
265
//第一页;
266
Button btnFirst = new Button();
267
btnFirst.ID = "btnFirst";
268
btnFirst.CssClass = "button";
269
btnFirst.Text = "第一页";
270
btnFirst.OnClientClick = "javascript:if(fn_Check(document.all." + _EditBox.ClientID + ",'" + this._strCount.Text.Trim() + "','F')==false) return false;";
271
btnFirst.Click += new EventHandler(First_Click);
272
this.Controls.Add(btnFirst);
273
this.Controls.Add(new LiteralControl(" "));
274
//上一页
275
Button btnPre = new Button();
276
btnPre.ID = "btnPre";
277
btnPre.Text = "上一页";
278
btnPre.CssClass = "button";
279
btnPre.OnClientClick = "javascript:if(fn_Check(document.all." + _EditBox.ClientID + ",'" + this._strCount.Text.Trim() + "','P')==false) return false;";
280
btnPre.Click += new EventHandler(Pre_Click);
281
this.Controls.Add(btnPre);
282
this.Controls.Add(new LiteralControl(" "));
283![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
284![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**////下一页
285
Button btnNext = new Button();
286
btnNext.ID = "btnNext";
287
btnNext.CssClass = "button";
288
btnNext.Text = "下一页";
289
btnNext.OnClientClick = "javascript:if(fn_Check(document.all." + _EditBox.ClientID + ",'" + this._strCount.Text.Trim() + "','N')==false) return false;";
290
btnNext.Click += new EventHandler(Next_Click);
291
this.Controls.Add(btnNext);
292
this.Controls.Add(new LiteralControl(" "));
293![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**////最后页
294
Button btnLast = new Button();
295
btnLast.ID = "btnLast";
296
btnLast.CssClass = "button";
297
btnLast.Text = "最后页";
298
btnLast.OnClientClick = "javascript:if(fn_Check(document.all." + _EditBox.ClientID + ",'" + this._strCount.Text.Trim() + "','L')==false) return false;";
299
btnLast.Click += new EventHandler(Last_Click);
300
this.Controls.Add(btnLast);
301
#endregion
302![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
303
}
304
catch (Exception exception2)
305![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
306
throw exception2;
307
}
308
}
309![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
310![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
311
/// 实现接口function
312
/// </summary>
313
/// <param name="postDataKey"></param>
314
/// <param name="postCollection"></param>
315
/// <returns></returns>
316
public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
317![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
318
return false;
319
}
320![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
321![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
322
/// 实现接口function
323
/// </summary>
324
public virtual void RaisePostDataChangedEvent()
325![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
326
try
327![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
328
//OnTextChanged(new Object(), new EventArgs());
329
}
330
catch (Exception exception2)
331![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
332
throw exception2;
333
}
334
}
335![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
336![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
337
/// 重载funciton
338
/// </summary>
339
/// <param name="writer"></param>
340
protected override void Render(HtmlTextWriter writer)
341![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
342
this.EnsureChildControls();
343
base.Render(writer);
344![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
345
}
346
347![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
348
/// 加入css及js
349
/// </summary>
350
/// <param name="e"></param>
351
protected override void OnPreRender(EventArgs e)
352![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
353![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
加入css#region 加入css
354
if (strCssLink == null || strCssLink == String.Empty)
355![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
356
string strcss = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), CSSResName);
357
strCssLink = string.Format("<link href='{0}' rel='stylesheet' type='text/css' title='green' />", strcss);
358
}
359
string cssKey = "ExtendDateNamecss";
360
if (this.Page.Header.FindControl(cssKey) != null)
361
return;
362
Literal ltlCss = new Literal();
363
ltlCss = new Literal();
364
ltlCss.ID = cssKey;
365
ltlCss.Text = strCssLink;
366![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
367
this.Parent.Page.Header.Controls.Add(ltlCss);
368![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**////
369
if (strJsLink == null || strJsLink == String.Empty)
370![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
371
string strjs = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), JSResName);
372
strJsLink = string.Format("<script src='{0}' type='text/javascript'></script>", strjs);
373
}
374
string jsKey = "ExtendDateNamejs";
375
if (this.Page.Header.FindControl(jsKey) != null)
376
return;
377
Literal ltljs = new Literal();
378
ltljs = new Literal();
379
ltljs.ID = jsKey;
380
ltljs.Text = strJsLink;
381
this.Parent.Page.Header.Controls.Add(ltljs);
382
#endregion
383
base.OnPreRender(e);
384
}
385![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
386![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
387
/// 重载function
388
/// </summary>
389
public override void DataBind()
390![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
391
try
392![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
393
base.DataBind();
394
}
395
catch (Exception exception2)
396![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
397
throw exception2;
398
}
399
}
400![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
401
#endregion
402
}
403
}
404![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2、Calendar.js
///判断当前页
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
function fn_Check(currpage,allpages,flg)
{
currpage=parseInt(currpage.value.trim());
allpages=parseInt(allpages);
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
switch(flg)
{
case "F":
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if(currpage==1)
{
alert("It is the first page");
return false;
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
}else
{
return true;
}
break;
case "P":
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if(currpage-1<=1)
{
alert("It is the first page");
return false;
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
}else
{
return true;
}
break;
case "L":
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if(currpage>=allpages)
{
alert("It is the last page");
return false;
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
}else
{
return true;
}
break;
case "N":
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if(currpage+1>=allpages)
{
alert("It is the last page");
return false;
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
}else
{
return true;
}
break;
case "G":
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if(currpage>allpages||currpage<1)
{
alert("No page");
return false;
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
}else
{
return true;
}
break;
}
return true;
}
3、Calendar.css
.button
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
}{
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//*参考button样式--huiqin*/
FILTER: progid:DXImageTransform.Microsoft.Gradient(startColorStr='white', endColorStr='aliceblue', gradientType='0');
COLOR: #333333;
FONT-FAMILY: verdana;
FONT-SIZE: 9pt;
border: 1px solid aliceblue;
}
.textbox
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
}{
background:#ffffff;
border-bottom-color:#CCCCCC;
border-bottom-width:1px;
border-top-width:1px;
border-left-width:1px;
border-right-width:1px;
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//*color:Gray;*/
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
text-decoration:none;/**//*文本样式*/
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
word-spacing:inherit;/**//*字间距离*/
font-size: 10pt; font-style:normal;
font-family:"宋体,Tahoma";bottom:0px;
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
height: 15px;/**//*文本框高度*/
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
width:30px;/**//*文本框宽度*/
line-height: normal
}
4、测试,调用
protected void Page_Load(object sender, EventArgs e)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
if (!this.IsPostBack)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
this.PagerCtl.Sql = " select * from dbo.m_Units ";
this.GridView1.DataSource = this.PagerCtl.DataSource;
this.GridView1.DataBind();
}
}
protected void PagerCtl_btnClick(object sender, EventArgs e)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
this.GridView1.DataSource = this.PagerCtl.DataSource;
this.GridView1.DataBind();
}