1 /* AspNetPager version 7.3.2
2 Copyright (C) 2003-2010 Webdiyer(http://en.webdiyer.com)
3
4 This file is part of AspNetPager.
5
6 AspNetPager is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 AspNetPager is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with AspNetPager. If not, see <http://www.gnu.org/licenses/>.
18 */
17
18 using System;
19 using System.ComponentModel;
20 using System.IO;
21 using System.Web.UI;
22 using System.Web.UI.WebControls;
23
24 namespace Wuqi.Webdiyer
25 {
26 public partial class AspNetPager
27 {
28 #region Private fields
29
30 private enum NavigationButton : byte
31 {
32 First, Prev, Next, Last
33 }
34
35 //private string cssClassName;
36 private string inputPageIndex;
37 private string currentUrl;
38 private string queryString;
39 private AspNetPager cloneFrom;
40 private static readonly object EventPageChanging = new object();
41 private static readonly object EventPageChanged = new object();
42 //bool pageChangeEventHandled = false;
43 //AspNetPager Version number, does not use reflection for perfomance reason
44 const string VersionNumber = "7.3.2";
45
46 #endregion
47
48 #region Navigation Buttons
49
50 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowNavigationToolTip"]/*'/>
51 [Browsable(true), ANPCategory("cat_Navigation"), DefaultValue(false), ANPDescription("desc_ShowNavigationToolTip"), Themeable(true)]
52 public bool ShowNavigationToolTip
53 {
54 get
55 {
56 if (null != cloneFrom)
57 return cloneFrom.ShowNavigationToolTip;
58 object obj = ViewState["ShowNvToolTip"];
59 return (obj == null) ? false : (bool)obj;
60 }
61 set
62 {
63 ViewState["ShowNvToolTip"] = value;
64 }
65 }
66
67 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="NavigationToolTipTextFormatString"]/*'/>
68 [Browsable(true), Themeable(true), ANPCategory("cat_Navigation"), ANPDefaultValue("def_NavigationToolTipTextFormatString"), ANPDescription("desc_NavigationToolTipTextFormatString")]
69 public string NavigationToolTipTextFormatString
70 {
71 get
72 {
73 if (null != cloneFrom)
74 return cloneFrom.NavigationToolTipTextFormatString;
75 object obj = ViewState["NvToolTipFormatString"];
76 if (obj == null)
77 {
78 if (ShowNavigationToolTip)
79 return SR.GetString("def_NavigationToolTipTextFormatString");
80 return null;
81 }
82 return (string)obj;
83 }
84 set
85 {
86 string tip = value;
87 if (tip.Trim().Length < 1 && tip.IndexOf("{0}") < 0)
88 tip = "{0}";
89 ViewState["NvToolTipFormatString"] = tip;
90 }
91 }
92
93 /// <include file='AspnetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="NumericButtonTextFormatString"]/*'/>
94 [Browsable(true), Themeable(true), DefaultValue(""), ANPCategory("cat_Navigation"), ANPDescription("desc_NBTFormatString")]
95 public string NumericButtonTextFormatString
96 {
97 get
98 {
99 if (null != cloneFrom)
100 return cloneFrom.NumericButtonTextFormatString;
101 object obj = ViewState["NumericButtonTextFormatString"];
102 return (obj == null) ? String.Empty : (string)obj;
103 }
104 set
105 {
106 ViewState["NumericButtonTextFormatString"] = value;
107 }
108 }
109
110 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CurrentPageButtonTextFormatString"]/*'/>
111 [Browsable(true), Themeable(true), DefaultValue(""), ANPCategory("cat_Navigation"), ANPDescription("desc_CPBTextFormatString")]
112 public string CurrentPageButtonTextFormatString
113 {
114 get
115 {
116 if (null != cloneFrom)
117 return cloneFrom.CurrentPageButtonTextFormatString;
118 object obj = ViewState["CurrentPageButtonTextFormatString"];
119 return (obj == null) ? NumericButtonTextFormatString : (string)obj;
120 }
121 set
122 {
123 ViewState["CurrentPageButtonTextFormatString"] = value;
124 }
125 }
126
127
128 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PagingButtonType"]/*'/>
129 [Browsable(true), Themeable(true), DefaultValue(PagingButtonType.Text), ANPCategory("cat_Navigation"), ANPDescription("desc_PagingButtonType")]
130 public PagingButtonType PagingButtonType
131 {
132 get
133 {
134 if (null != cloneFrom)
135 return cloneFrom.PagingButtonType;
136 object obj = ViewState["PagingButtonType"];
137 return (obj == null) ? PagingButtonType.Text : (PagingButtonType)obj;
138 }
139 set
140 {
141 ViewState["PagingButtonType"] = value;
142 }
143 }
144
145 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="NumericButtonType"]/*'/>
146 [Browsable(true), Themeable(true), DefaultValue(PagingButtonType.Text), ANPCategory("cat_Navigation"), ANPDescription("desc_NumericButtonType")]
147 public PagingButtonType NumericButtonType
148 {
149 get
150 {
151 if (null != cloneFrom)
152 return cloneFrom.NumericButtonType;
153 object obj = ViewState["NumericButtonType"];
154 return (obj == null) ? PagingButtonType : (PagingButtonType)obj;
155 }
156 set
157 {
158 ViewState["NumericButtonType"] = value;
159 }
160 }
161
162 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PagingButtonLayoutType"]/*'/>
163 [Browsable(true), Themeable(true), DefaultValue(PagingButtonLayoutType.None), ANPCategory("cat_Navigation"), ANPDescription("desc_PagingButtonLayoutType")]
164 public PagingButtonLayoutType PagingButtonLayoutType
165 {
166 get
167 {
168 if (null != cloneFrom)
169 return cloneFrom.PagingButtonLayoutType;
170 object obj = ViewState["PagingButtonLayoutType"];
171 return (obj == null) ? PagingButtonLayoutType.None : (PagingButtonLayoutType)obj;
172 }
173 set { ViewState["PagingButtonLayoutType"] = value; }
174 }
175
176 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CurrentPageButtonPosition"]/*'/>
177 [Browsable(true), Themeable(true), DefaultValue(PagingButtonPosition.Fixed), ANPCategory("cat_Navigation"), ANPDescription("desc_CurrentPageButtonPosition")]
178 public PagingButtonPosition CurrentPageButtonPosition
179 {
180 get
181 {
182 if (null != cloneFrom)
183 return cloneFrom.CurrentPageButtonPosition;
184 object obj = ViewState["CurrentPageButtonPosition"];
185 return (obj == null) ? PagingButtonPosition.Fixed : (PagingButtonPosition)obj;
186 }
187 set { ViewState["CurrentPageButtonPosition"] = value; }
188 }
189
190 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="NavigationButtonsPosition"]/*'/>
191 [Browsable(true), Themeable(true), DefaultValue(NavigationButtonPosition.BothSides), ANPCategory("cat_Navigation"), ANPDescription("desc_NavigationButtonsPosition")]
192 public NavigationButtonPosition NavigationButtonsPosition
193 {
194 get
195 {
196 if (null != cloneFrom)
197 return cloneFrom.NavigationButtonsPosition;
198 object obj = ViewState["NavigationButtonsPosition"];
199 return (obj == null) ? NavigationButtonPosition.BothSides : (NavigationButtonPosition)obj;
200 }
201 set { ViewState["NavigationButtonsPosition"] = value; }
202
203 }
204
205 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="NavigationButtonType"]/*'/>
206 [Browsable(true), Themeable(true), ANPCategory("cat_Navigation"), DefaultValue(PagingButtonType.Text), ANPDescription("desc_NavigationButtonType")]
207 public PagingButtonType NavigationButtonType
208 {
209 get
210 {
211 if (null != cloneFrom)
212 return cloneFrom.NavigationButtonType;
213 object obj = ViewState["NavigationButtonType"];
214 return (obj == null) ? PagingButtonType : (PagingButtonType)obj;
215 }
216 set
217 {
218 ViewState["NavigationButtonType"] = value;
219 }
220 }
221
222 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="UrlPagingTarget"]/*'/>
223 [Browsable(true), Themeable(true), DefaultValue(""), TypeConverter(typeof(TargetConverter)), ANPCategory("cat_Navigation"), ANPDescription("desc_UrlPagingTarget")]
224 public string UrlPagingTarget
225 {
226 get
227 {
228 if (null != cloneFrom)
229 return cloneFrom.UrlPagingTarget;
230 return (string)ViewState["UrlPagingTarget"];
231 }
232 set
233 {
234 ViewState["UrlPagingTarget"] = value;
235 }
236 }
237
238 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="MoreButtonType"]/*'/>
239 [Browsable(true), Themeable(true), ANPCategory("cat_Navigation"), DefaultValue(PagingButtonType.Text), ANPDescription("desc_MoreButtonType")]
240 public PagingButtonType MoreButtonType
241 {
242 get
243 {
244 if (null != cloneFrom)
245 return cloneFrom.MoreButtonType;
246 object obj = ViewState["MoreButtonType"];
247 return (obj == null) ? PagingButtonType : (PagingButtonType)obj;
248 }
249 set
250 {
251 ViewState["MoreButtonType"] = value;
252 }
253 }
254
255 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PagingButtonSpacing"]/*'/>
256 [Browsable(true), Themeable(true), ANPCategory("cat_Navigation"), DefaultValue(typeof(Unit), "5px"), ANPDescription("desc_PagingButtonSpacing")]
257 public Unit PagingButtonSpacing
258 {
259 get
260 {
261 if (null != cloneFrom)
262 return cloneFrom.PagingButtonSpacing;
263 object obj = ViewState["PagingButtonSpacing"];
264 return (obj == null) ? Unit.Pixel(5) : (Unit.Parse(obj.ToString()));
265 }
266 set
267 {
268 ViewState["PagingButtonSpacing"] = value;
269 }
270 }
271
272 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowFirstLast"]/*'/>
273 [Browsable(true), Themeable(true), ANPDescription("desc_ShowFirstLast"), ANPCategory("cat_Navigation"), DefaultValue(true)]
274 public bool ShowFirstLast
275 {
276 get
277 {
278 if (null != cloneFrom)
279 return cloneFrom.ShowFirstLast;
280 object obj = ViewState["ShowFirstLast"];
281 return (obj == null) ? true : (bool)obj;
282 }
283 set { ViewState["ShowFirstLast"] = value; }
284 }
285
286 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowPrevNext"]/*'/>
287 [Browsable(true), Themeable(true), ANPDescription("desc_ShowPrevNext"), ANPCategory("cat_Navigation"), DefaultValue(true)]
288 public bool ShowPrevNext
289 {
290 get
291 {
292 if (null != cloneFrom)
293 return cloneFrom.ShowPrevNext;
294 object obj = ViewState["ShowPrevNext"];
295 return (obj == null) ? true : (bool)obj;
296 }
297 set { ViewState["ShowPrevNext"] = value; }
298 }
299
300 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowPageIndex"]/*'/>
301 [Browsable(true), Themeable(true), ANPDescription("desc_ShowPageIndex"), ANPCategory("cat_Navigation"), DefaultValue(true)]
302 public bool ShowPageIndex
303 {
304 get
305 {
306 if (null != cloneFrom)
307 return cloneFrom.ShowPageIndex;
308 object obj = ViewState["ShowPageIndex"];
309 return (obj == null) ? true : (bool)obj;
310 }
311 set { ViewState["ShowPageIndex"] = value; }
312 }
313
314 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowMoreButtons"]/*'/>
315 [Browsable(true), Themeable(true), ANPDescription("desc_ShowMoreButtons"), ANPCategory("cat_Navigation"), DefaultValue(true)]
316 public bool ShowMoreButtons
317 {
318 get
319 {
320 if (null != cloneFrom)
321 return cloneFrom.ShowMoreButtons;
322 object obj = ViewState["ShowMoreButtons"];
323 return (obj == null) ? true : (bool)obj;
324 }
325 set { ViewState["ShowMoreButtons"] = value; }
326 }
327
328 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="FirstPageText"]/*'/>
329 [Browsable(true), Themeable(true), ANPDescription("desc_FirstPageText"), ANPCategory("cat_Navigation"), DefaultValue("<<")]
330 public string FirstPageText
331 {
332 get
333 {
334 if (null != cloneFrom)
335 return cloneFrom.FirstPageText;
336 object obj = ViewState["FirstPageText"];
337 return (obj == null) ? "<<" : (string)obj;
338 }
339 set { ViewState["FirstPageText"] = value; }
340 }
341
342 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PrevPageText"]/*'/>
343 [Browsable(true), Themeable(true), ANPDescription("desc_PrevPageText"), ANPCategory("cat_Navigation"), DefaultValue("<")]
344 public string PrevPageText
345 {
346 get
347 {
348 if (null != cloneFrom)
349 return cloneFrom.PrevPageText;
350 object obj = ViewState["PrevPageText"];
351 return (obj == null) ? "<" : (string)obj;
352 }
353 set { ViewState["PrevPageText"] = value; }
354 }
355
356 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="NextPageText"]/*'/>
357 [Browsable(true), Themeable(true), ANPDescription("desc_NextPageText"), ANPCategory("cat_Navigation"), DefaultValue(">")]
358 public string NextPageText
359 {
360 get
361 {
362 if (null != cloneFrom)
363 return cloneFrom.NextPageText;
364 object obj = ViewState["NextPageText"];
365 return (obj == null) ? ">" : (string)obj;
366 }
367 set { ViewState["NextPageText"] = value; }
368 }
369
370 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="LastPageText"]/*'/>
371 [Browsable(true), Themeable(true), ANPDescription("desc_LastPageText"), ANPCategory("cat_Navigation"), DefaultValue(">>")]
372 public string LastPageText
373 {
374 get
375 {
376 if (null != cloneFrom)
377 return cloneFrom.LastPageText;
378 object obj = ViewState["LastPageText"];
379 return (obj == null) ? ">>" : (string)obj;
380 }
381 set { ViewState["LastPageText"] = value; }
382 }
383
384 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="NumericButtonCount"]/*'/>
385 [Browsable(true), Themeable(true), ANPDescription("desc_NumericButtonCount"), ANPCategory("cat_Navigation"), DefaultValue(10)]
386 public int NumericButtonCount
387 {
388 get
389 {
390 if (null != cloneFrom)
391 return cloneFrom.NumericButtonCount;
392 object obj = ViewState["NumericButtonCount"];
393 return (obj == null) ? 10 : (int)obj;
394 }
395 set { ViewState["NumericButtonCount"] = value; }
396 }
397
398 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowDisabledButtons"]/*'/>
399 [Browsable(true), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_ShowDisabledButtons"), DefaultValue(true)]
400 public bool ShowDisabledButtons
401 {
402 get
403 {
404 if (null != cloneFrom)
405 return cloneFrom.ShowDisabledButtons;
406 object obj = ViewState["ShowDisabledButtons"];
407 return (obj == null) ? true : (bool)obj;
408 }
409 set
410 {
411 ViewState["ShowDisabledButtons"] = value;
412 }
413 }
414
415 #endregion
416
417 #region Image Navigation Buttons
418
419 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ImagePath"]/*'/>
420 [Browsable(true), Category("Appearance"), ANPDescription("desc_ImagePath"), DefaultValue(null)]
421 public string ImagePath
422 {
423 get
424 {
425 if (null != cloneFrom)
426 return cloneFrom.ImagePath;
427 string imgPath = (string)ViewState["ImagePath"];
428 if (imgPath != null)
429 imgPath = ResolveUrl(imgPath);
430 return imgPath;
431 }
432 set
433 {
434 string imgPath = value.Trim().Replace("\\", "/");
435 ViewState["ImagePath"] = (imgPath.EndsWith("/")) ? imgPath : imgPath + "/";
436 }
437 }
438
439 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ButtonImageExtension"]/*'/>
440 [Browsable(true), Themeable(true), Category("Appearance"), DefaultValue(".gif"), ANPDescription("desc_ButtonImageExtension")]
441 public string ButtonImageExtension
442 {
443 get
444 {
445 if (null != cloneFrom)
446 return cloneFrom.ButtonImageExtension;
447 object obj = ViewState["ButtonImageExtension"];
448 return (obj == null) ? ".gif" : (string)obj;
449 }
450 set
451 {
452 string ext = value.Trim();
453 ViewState["ButtonImageExtension"] = (ext.StartsWith(".")) ? ext : ("." + ext);
454 }
455 }
456
457 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ButtonImageNameExtension"]/*'/>
458 [Browsable(true), Themeable(true), DefaultValue(null), Category("Appearance"), ANPDescription("desc_ButtonImageNameExtension")]
459 public string ButtonImageNameExtension
460 {
461 get
462 {
463 if (null != cloneFrom)
464 return cloneFrom.ButtonImageNameExtension;
465 object obj = ViewState["ButtonImageNameExtension"];
466 return (obj == null) ? null : (string)obj;
467 }
468 set
469 {
470 ViewState["ButtonImageNameExtension"] = value;
471 }
472 }
473
474 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CpiButtonImageNameExtension"]/*'/>
475 [Browsable(true), Themeable(true), DefaultValue(null), Category("Appearance"), ANPDescription("desc_CpiButtonImageNameExtension")]
476 public string CpiButtonImageNameExtension
477 {
478 get
479 {
480 if (null != cloneFrom)
481 return cloneFrom.CpiButtonImageNameExtension;
482 object obj = ViewState["CpiButtonImageNameExtension"];
483 return (obj == null) ? ButtonImageNameExtension : (string)obj;
484 }
485 set
486 {
487 ViewState["CpiButtonImageNameExtension"] = value;
488 }
489 }
490
491 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="DisabledButtonImageNameExtension"]/*'/>
492 [Browsable(true), Themeable(true), DefaultValue(null), Category("Appearance"), ANPDescription("desc_DisabledButtonImageNameExtension")]
493 public string DisabledButtonImageNameExtension
494 {
495 get
496 {
497 if (null != cloneFrom)
498 return cloneFrom.DisabledButtonImageNameExtension;
499 object obj = ViewState["DisabledButtonImageNameExtension"];
500 return (obj == null) ? ButtonImageNameExtension : (string)obj;
501 }
502 set
503 {
504 ViewState["DisabledButtonImageNameExtension"] = value;
505 }
506 }
507
508 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ButtonImageAlign"]/*'/>
509 [Browsable(true), ANPDescription("desc_ButtonImageAlign"), DefaultValue(ImageAlign.NotSet), Category("Appearance")]
510 public ImageAlign ButtonImageAlign
511 {
512 get
513 {
514 if (null != cloneFrom)
515 return cloneFrom.ButtonImageAlign;
516 object obj = ViewState["ButtonImageAlign"];
517 return (obj == null) ? ImageAlign.NotSet : (ImageAlign)obj;
518 }
519 set
520 {
521 if (value != ImageAlign.Right && value != ImageAlign.Left)
522 ViewState["ButtonImageAlign"] = value;
523 }
524 }
525
526
527 #endregion
528
529 #region Paging
530
531 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="UrlPaging"]/*'/>
532 [Browsable(true), ANPCategory("cat_Paging"), DefaultValue(false), ANPDescription("desc_UrlPaging")]
533 public bool UrlPaging
534 {
535 get
536 {
537 if (null != cloneFrom)
538 return cloneFrom.UrlPaging;
539 object obj = ViewState["UrlPaging"];
540 return (null == obj) ? false : (bool)obj;
541 }
542 set
543 {
544 ViewState["UrlPaging"] = value;
545 }
546 }
547
548 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="UrlPageIndexName"]/*'/>
549 [Browsable(true), DefaultValue("page"), ANPCategory("cat_Paging"), ANPDescription("desc_UrlPageIndexName")]
550 public string UrlPageIndexName
551 {
552 get
553 {
554 if (null != cloneFrom)
555 return cloneFrom.UrlPageIndexName;
556 object obj = ViewState["UrlPageIndexName"];
557 return (null == obj) ? "page" : (string)obj;
558 }
559 set { ViewState["UrlPageIndexName"] = value; }
560 }
561
562 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="UrlPageSizeName"]/*'/>
563 [Browsable(true), DefaultValue(""), ANPCategory("cat_Paging"), ANPDescription("desc_UrlPageSizeName")]
564 public string UrlPageSizeName
565 {
566 get
567 {
568 if (null != cloneFrom)
569 return cloneFrom.UrlPageSizeName;
570 return (string)ViewState["UrlPageSizeName"];
571 }
572 set { ViewState["UrlPageSizeName"] = value; }
573 }
574
575 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ReverseUrlPageIndex"]/*'/>
576 [Browsable(true), DefaultValue(false), ANPCategory("cat_Paging"), ANPDescription("desc_ReverseUrlPageIndex")]
577 public bool ReverseUrlPageIndex
578 {
579 get
580 {
581 if (null != cloneFrom)
582 return cloneFrom.ReverseUrlPageIndex;
583 object obj = ViewState["ReverseUrlPageIndex"];
584 return (null == obj) ? false : (bool)obj;
585 }
586 set { ViewState["ReverseUrlPageIndex"] = value; }
587 }
588
589
590 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CurrentPageIndex"]/*'/>
591 [Browsable(true), ANPDescription("desc_CurrentPageIndex"), ANPCategory("cat_Paging"), DefaultValue(1)]
592 public int CurrentPageIndex
593 {
594 get
595 {
596 if (null != cloneFrom)
597 return cloneFrom.CurrentPageIndex;
598 object cpage = ViewState["CurrentPageIndex"];
599 int pindex = (cpage == null) ? 1 : (int)cpage;
600 if (pindex > PageCount && PageCount > 0)
601 return PageCount;
602 if (pindex < 1)
603 return 1;
604 return pindex;
605 }
606 set
607 {
608 int cpage = value;
609 if (cpage < 1)
610 cpage = 1;
611 else if (cpage > PageCount)
612 cpage = PageCount;
613 ViewState["CurrentPageIndex"] = cpage;
614 //if(!pageChangeEventHandled)
615 //{
616 // OnPageChanging(new PageChangingEventArgs(cpage));
617 //}
618 }
619 }
620
621 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="RecordCount"]/*'/>
622 [Browsable(false), ANPDescription("desc_RecordCount"), Category("Data"), DefaultValue(0)]
623 public int RecordCount
624 {
625 get
626 {
627 if (null != cloneFrom)
628 return cloneFrom.RecordCount;
629 object obj = ViewState["Recordcount"];
630 return (obj == null) ? 0 : (int)obj;
631 }
632 set { ViewState["Recordcount"] = value; }
633 }
634
635 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PagesRemain"]/*'/>
636 [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
637 public int PagesRemain
638 {
639 get
640 {
641 return PageCount - CurrentPageIndex;
642 }
643 }
644
645 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PageSize"]/*'/>
646 [Browsable(true), ANPDescription("desc_PageSize"), ANPCategory("cat_Paging"), DefaultValue(10)]
647 public int PageSize
648 {
649 get
650 {
651 if (!string.IsNullOrEmpty(UrlPageSizeName) && !DesignMode)
652 {
653 int pageSize;
654 if (int.TryParse(Page.Request.QueryString[UrlPageSizeName], out pageSize))
655 {
656 if (pageSize > 0)
657 return pageSize;
658 }
659 }
660 if (null != cloneFrom)
661 return cloneFrom.PageSize;
662 object obj = ViewState["PageSize"];
663 return (obj == null) ? 10 : (int)obj;
664 }
665 set
666 {
667 ViewState["PageSize"] = value;
668 }
669 }
670
671 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="RecordsRemain"]/*'/>
672 [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
673 public int RecordsRemain
674 {
675 get
676 {
677 if (CurrentPageIndex < PageCount)
678 return RecordCount - (CurrentPageIndex * PageSize);
679 return 0;
680 }
681 }
682
683 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="StartRecordIndex"]/*'/>
684 [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
685 public int StartRecordIndex
686 {
687 get
688 {
689 //if (FillLastPage && RecordCount > PageSize && CurrentPageIndex == PageCount)
690 // return RecordCount - PageSize;
691 return (CurrentPageIndex - 1) * PageSize + 1;
692 }
693 }
694
695
696 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="EndRecordIndex"]/*'/>
697 [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
698 public int EndRecordIndex
699 {
700 get
701 {
702 return RecordCount - RecordsRemain;
703 }
704 }
705
706 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PageCount"]/*'/>
707 [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
708 public int PageCount
709 {
710 get
711 {
712 if (RecordCount == 0)
713 return 1;
714 return (int)Math.Ceiling((double)RecordCount / (double)PageSize);
715 }
716 }
717
718
719 #endregion
720
721 #region Page index box
722
723
724 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowPageIndexBox"]/*'/>
725 [Browsable(true), ANPCategory("cat_PageIndexBox"), DefaultValue(null), ANPDescription("desc_ShowPageIndexBox")]
726 public ShowPageIndexBox ShowPageIndexBox
727 {
728 get
729 {
730 if (null != cloneFrom)
731 return cloneFrom.ShowPageIndexBox;
732 object obj = ViewState["ShowPageIndexBox"];
733 return (obj == null) ? ShowPageIndexBox.Auto : (ShowPageIndexBox)obj;
734 }
735 set { ViewState["ShowPageIndexBox"] = value; }
736 }
737
738 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PageIndexBoxType"]/*'/>
739 [Browsable(true), ANPCategory("cat_PageIndexBox"), DefaultValue(null), ANPDescription("desc_PageIndexBoxType")]
740 public PageIndexBoxType PageIndexBoxType
741 {
742 get
743 {
744 if (null != cloneFrom)
745 return cloneFrom.PageIndexBoxType;
746 object obj = ViewState["PageIndexBoxType"];
747 return (obj == null) ? PageIndexBoxType.TextBox : (PageIndexBoxType)obj;
748 }
749 set
750 {
751 ViewState["PageIndexBoxType"] = value;
752 }
753 }
754
755
756 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PageIndexBoxClass"]/*'/>
757 [Browsable(true), ANPCategory("cat_PageIndexBox"), DefaultValue(null), ANPDescription("desc_PageIndexBoxClasss")]
758 public string PageIndexBoxClass
759 {
760 get
761 {
762 if (null != cloneFrom)
763 return cloneFrom.PageIndexBoxClass;
764 object obj = ViewState["PageIndexBoxClass"];
765 return (obj == null) ? null : (string)obj;
766 }
767 set
768 {
769 if (value.Trim().Length > 0)
770 ViewState["PageIndexBoxClass"] = value;
771 }
772 }
773
774
775 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PageIndexBoxStyle"]/*'/>
776 [Browsable(true), ANPCategory("cat_PageIndexBox"), DefaultValue(null), ANPDescription("desc_PageIndexBoxStyle")]
777 public string PageIndexBoxStyle
778 {
779 get
780 {
781 if (null != cloneFrom)
782 return cloneFrom.PageIndexBoxStyle;
783 object obj = ViewState["PageIndexBoxStyle"];
784 return (obj == null) ? null : (string)obj;
785 }
786 set
787 {
788 if (value.Trim().Length > 0)
789 ViewState["PageIndexBoxStyle"] = value;
790 }
791 }
792
793
794 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="TextBeforePageIndexBox"]/*'/>
795 [Browsable(true), Themeable(true), ANPCategory("cat_PageIndexBox"), DefaultValue(null), ANPDescription("desc_TextBeforePageIndexBox")]
796 public string TextBeforePageIndexBox
797 {
798 get
799 {
800 if (null != cloneFrom)
801 return cloneFrom.TextBeforePageIndexBox;
802 object obj = ViewState["TextBeforePageIndexBox"];
803 return (null == obj) ? null : (string)obj;
804 }
805 set
806 {
807 ViewState["TextBeforePageIndexBox"] = value;
808 }
809 }
810
811
812 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="TextAfterPageIndexBox"]/*'/>
813 [Browsable(true), Themeable(true), DefaultValue(null), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_TextAfterPageIndexBox")]
814 public string TextAfterPageIndexBox
815 {
816 get
817 {
818 if (null != cloneFrom)
819 return cloneFrom.TextAfterPageIndexBox;
820 object obj = ViewState["TextAfterPageIndexBox"];
821 return (null == obj) ? null : (string)obj;
822 }
823 set
824 {
825 ViewState["TextAfterPageIndexBox"] = value;
826 }
827 }
828
829 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="SubmitButtonText"]/*'/>
830 [Browsable(true), Themeable(true), ANPCategory("cat_PageIndexBox"), DefaultValue("go"), ANPDescription("desc_SubmitButtonText")]
831 public string SubmitButtonText
832 {
833 get
834 {
835 if (null != cloneFrom)
836 return cloneFrom.SubmitButtonText;
837 object obj = ViewState["SubmitButtonText"];
838 return (null == obj) ? "go" : (string)obj;
839 }
840 set
841 {
842 if (null == value)
843 value = "go";
844 ViewState["SubmitButtonText"] = value;
845 }
846 }
847
848 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="SubmitButtonClass"]/*'/>
849 [Browsable(true), ANPCategory("cat_PageIndexBox"), DefaultValue(null), ANPDescription("desc_SubmitButtonClass")]
850 public string SubmitButtonClass
851 {
852 get
853 {
854 if (null != cloneFrom)
855 return cloneFrom.SubmitButtonClass;
856 return (string)ViewState["SubmitButtonClass"];
857 }
858 set
859 {
860 ViewState["SubmitButtonClass"] = value;
861 }
862 }
863
864 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="SubmitButtonStyle"]/*'/>
865 [Browsable(true), ANPCategory("cat_PageIndexBox"), DefaultValue(null), ANPDescription("desc_SubmitButtonStyle")]
866 public string SubmitButtonStyle
867 {
868 get
869 {
870 if (null != cloneFrom)
871 return cloneFrom.SubmitButtonStyle;
872 return (string)ViewState["SubmitButtonStyle"];
873 }
874 set
875 {
876 ViewState["SubmitButtonStyle"] = value;
877 }
878 }
879
880 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="SubmitButtonImageUrl"]/*'/>
881 [Browsable(true), DefaultValue(""), Category("Appearance"), ANPDescription("desc_SubmitButtonImageUrl")]
882 public string SubmitButtonImageUrl
883 {
884 get
885 {
886 if (null != cloneFrom)
887 return cloneFrom.SubmitButtonImageUrl;
888 return (string)ViewState["SubmitButtonImageUrl"];
889 }
890 set { ViewState["SubmitButtonImageUrl"] = value; }
891 }
892
893 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowBoxThreshold"]/*'/>
894 [Browsable(true), Themeable(true), ANPDescription("desc_ShowBoxThreshold"), ANPCategory("cat_PageIndexBox"), DefaultValue(30)]
895 public int ShowBoxThreshold
896 {
897 get
898 {
899 if (null != cloneFrom)
900 return cloneFrom.ShowBoxThreshold;
901 object obj = ViewState["ShowBoxThreshold"];
902 return (null == obj) ? 30 : (int)obj;
903 }
904 set { ViewState["ShowBoxThreshold"] = value; }
905 }
906
907
908 #endregion
909
910 #region CustomInfoSection
911
912 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowCustomInfoSection"]/*'/>
913 [Browsable(true), Themeable(true), ANPDescription("desc_ShowCustomInfoSection"), DefaultValue(ShowCustomInfoSection.Never), Category("Appearance")]
914 public ShowCustomInfoSection ShowCustomInfoSection
915 {
916 get
917 {
918 if (null != cloneFrom)
919 return cloneFrom.ShowCustomInfoSection;
920 object obj = ViewState["ShowCustomInfoSection"];
921 return (null == obj) ? ShowCustomInfoSection.Never : (ShowCustomInfoSection)obj;
922 }
923 set { ViewState["ShowCustomInfoSection"] = value; }
924 }
925
926 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CustomInfoTextAlign"]/*'/>
927 [Browsable(true), Category("Appearance"), DefaultValue(HorizontalAlign.NotSet), ANPDescription("desc_CustomInfoTextAlign")]
928 public HorizontalAlign CustomInfoTextAlign
929 {
930 get
931 {
932 if (null != cloneFrom)
933 return cloneFrom.CustomInfoTextAlign;
934 object obj = ViewState["CustomInfoTextAlign"];
935 return (null == obj) ? HorizontalAlign.NotSet : (HorizontalAlign)obj;
936 }
937 set
938 {
939 ViewState["CustomInfoTextAlign"] = value;
940 }
941 }
942
943 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CustomInfoSectionWidth"]/*'/>
944 [Browsable(true), Category("Appearance"), DefaultValue(typeof(Unit), "40%"), ANPDescription("desc_CustomInfoSectionWidth")]
945 public Unit CustomInfoSectionWidth
946 {
947 get
948 {
949 if (null != cloneFrom)
950 return cloneFrom.CustomInfoSectionWidth;
951 object obj = ViewState["CustomInfoSectionWidth"];
952 return (null == obj) ? Unit.Percentage(40) : (Unit)obj;
953 }
954 set
955 {
956 ViewState["CustomInfoSectionWidth"] = value;
957 }
958 }
959
960 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CustomInfoClass"]/*'/>
961 [Browsable(true), Category("Appearance"), DefaultValue(null), ANPDescription("desc_CustomInfoClass")]
962 public string CustomInfoClass
963 {
964 get
965 {
966 if (null != cloneFrom)
967 return cloneFrom.CustomInfoClass;
968 object obj = ViewState["CustomInfoClass"];
969 return (null == obj) ? CssClass : (string)obj;
970 }
971 set
972 {
973 ViewState["CustomInfoClass"] = value;
974 }
975 }
976
977 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CustomInfoStyle"]/*'/>
978 [Browsable(true), Category("Appearance"), DefaultValue(null), ANPDescription("desc_CustomInfoStyle")]
979 public string CustomInfoStyle
980 {
981 get
982 {
983 if (null != cloneFrom)
984 return cloneFrom.CustomInfoStyle;
985 object obj = ViewState["CustomInfoStyle"];
986 return (null == obj) ? Style.Value : (string)obj;
987 }
988 set
989 {
990 ViewState["CustomInfoStyle"] = value;
991 }
992 }
993
994 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CustomInfoHTML"]/*'/>
995 [Browsable(true), Themeable(true), Category("Appearance"), DefaultValue("Page %CurrentPageIndex% of %PageCount%"), ANPDescription("desc_CustomInfoHTML")]
996 public string CustomInfoHTML
997 {
998 get
999 {
1000 if (null != cloneFrom)
1001 return cloneFrom.CustomInfoHTML;
1002 object obj = ViewState["CustomInfoText"];
1003 return (null == obj) ? "Page %CurrentPageIndex% of %PageCount%" : (string)obj;
1004 }
1005 set
1006 {
1007 ViewState["CustomInfoText"] = value;
1008 }
1009 }
1010
1011 #endregion
1012
1013 #region Css class and styles
1014
1015
1016 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CurrentPageButtonStyle"]/*'/>
1017 [Browsable(true), Category("Appearance"), ANPDescription("desc_CurrentPageButtonStyle"), DefaultValue(null)]
1018 public string CurrentPageButtonStyle
1019 {
1020 get
1021 {
1022 if (null != cloneFrom)
1023 return cloneFrom.CurrentPageButtonStyle;
1024 object obj = ViewState["CPBStyle"];
1025 return (null == obj) ? null : (string)obj;
1026 }
1027 set
1028 {
1029 ViewState["CPBStyle"] = value;
1030 }
1031 }
1032
1033 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CurrentPageButtonClass"]/*'/>
1034 [Browsable(true), Category("Appearance"), ANPDescription("desc_CurrentPageButtonClass"), DefaultValue(null)]
1035 public string CurrentPageButtonClass
1036 {
1037 get
1038 {
1039 if (null != cloneFrom)
1040 return cloneFrom.CurrentPageButtonClass;
1041 object obj = ViewState["CPBClass"];
1042 return (null == obj) ? null : (string)obj;
1043 }
1044 set
1045 {
1046 ViewState["CPBClass"] = value;
1047 }
1048 }
1049
1050
1051 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PagingButtonsClass"]/*'/>
1052 [Browsable(true), Category("Appearance"), Themeable(true), ANPDescription("desc_PagingButtonClass"), DefaultValue(null)]
1053 public string PagingButtonsClass
1054 {
1055 get
1056 {
1057 if (null != cloneFrom)
1058 return cloneFrom.PagingButtonsClass;
1059 object obj = ViewState["PagingButtonsClass"];
1060 return (null == obj) ? null : (string)obj;
1061 }
1062 set
1063 {
1064 ViewState["PagingButtonsClass"] = value;
1065 }
1066 }
1067
1068 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PagingButtonsStyle"]/*'/>
1069 [Browsable(true), Category("Appearance"), Themeable(true), ANPDescription("desc_PagingButtonStyle"), DefaultValue(null)]
1070 public string PagingButtonsStyle
1071 {
1072 get
1073 {
1074 if (null != cloneFrom)
1075 return cloneFrom.PagingButtonsStyle;
1076 object obj = ViewState["PagingButtonsStyle"];
1077 return (null == obj) ? null : (string)obj;
1078 }
1079 set
1080 {
1081 ViewState["PagingButtonsStyle"] = value;
1082 }
1083 }
1084
1085 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="FirstLastButtonsClass"]/*'/>
1086 [Browsable(true), Category("Appearance"), Themeable(true), ANPDescription("desc_FirstLastButtonsClass"), DefaultValue(null)]
1087 public string FirstLastButtonsClass
1088 {
1089 get
1090 {
1091 if (null != cloneFrom)
1092 return cloneFrom.FirstLastButtonsClass;
1093 object obj = ViewState["FirstLastButtonsClass"];
1094 return (null == obj) ? PagingButtonsClass : (string)obj;
1095 }
1096 set
1097 {
1098 ViewState["FirstLastButtonsClass"] = value;
1099 }
1100 }
1101
1102 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="FirstLastButtonsStyle"]/*'/>
1103 [Browsable(true), Category("Appearance"), Themeable(true), ANPDescription("desc_FirstLastButtonsStyle"), DefaultValue(null)]
1104 public string FirstLastButtonsStyle
1105 {
1106 get
1107 {
1108 if (null != cloneFrom)
1109 return cloneFrom.FirstLastButtonsStyle;
1110 object obj = ViewState["FirstLastButtonsStyle"];
1111 return (null == obj) ? PagingButtonsStyle : (string)obj;
1112 }
1113 set
1114 {
1115 ViewState["FirstLastButtonsStyle"] = value;
1116 }
1117 }
1118
1119 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PrevNextButtonsClass"]/*'/>
1120 [Browsable(true), Category("Appearance"), Themeable(true), ANPDescription("desc_PrevNextButtonsClass"), DefaultValue(null)]
1121 public string PrevNextButtonsClass
1122 {
1123 get
1124 {
1125 if (null != cloneFrom)
1126 return cloneFrom.PrevNextButtonsClass;
1127 object obj = ViewState["PrevNextButtonsClass"];
1128 return (null == obj) ? PagingButtonsClass : (string)obj;
1129 }
1130 set
1131 {
1132 ViewState["PrevNextButtonsClass"] = value;
1133 }
1134 }
1135
1136 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PrevNextButtonsStyle"]/*'/>
1137 [Browsable(true), Category("Appearance"), Themeable(true), ANPDescription("desc_PrevNextButtonsStyle"), DefaultValue(null)]
1138 public string PrevNextButtonsStyle
1139 {
1140 get
1141 {
1142 if (null != cloneFrom)
1143 return cloneFrom.PrevNextButtonsStyle;
1144 object obj = ViewState["PrevNextButtonsStyle"];
1145 return (null == obj) ? PagingButtonsStyle : (string)obj;
1146 }
1147 set
1148 {
1149 ViewState["PrevNextButtonsStyle"] = value;
1150 }
1151 }
1152
1153 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="MoreButtonsClass"]/*'/>
1154 [Browsable(true), Category("Appearance"), Themeable(true), ANPDescription("desc_MoreButtonsClass"), DefaultValue(null)]
1155 public string MoreButtonsClass
1156 {
1157 get
1158 {
1159 if (null != cloneFrom)
1160 return cloneFrom.MoreButtonsClass;
1161 object obj = ViewState["MoreButtonsClass"];
1162 return (null == obj) ? PagingButtonsClass : (string)obj;
1163 }
1164 set
1165 {
1166 ViewState["MoreButtonsClass"] = value;
1167 }
1168 }
1169
1170 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="MoreButtonsStyle"]/*'/>
1171 [Browsable(true), Category("Appearance"), Themeable(true), ANPDescription("desc_MoreButtonsStyle"), DefaultValue(null)]
1172 public string MoreButtonsStyle
1173 {
1174 get
1175 {
1176 if (null != cloneFrom)
1177 return cloneFrom.MoreButtonsStyle;
1178 object obj = ViewState["MoreButtonsStyle"];
1179 return (null == obj) ? PagingButtonsStyle : (string)obj;
1180 }
1181 set
1182 {
1183 ViewState["MoreButtonsStyle"] = value;
1184 }
1185 }
1186
1187 /*
1188 public string DisabledButtonsClass
1189 {
1190 get
1191 {
1192 if (null != cloneFrom)
1193 return cloneFrom.DisabledButtonsClass;
1194 object obj = ViewState["DisabledButtonsClass"];
1195 return (null == obj) ? DisabledButtonsClass : (string)obj;
1196 }
1197 set
1198 {
1199 ViewState["DisabledButtonsClass"] = value;
1200 }
1201 }
1202
1203
1204 public string DisabledButtonsStyle
1205 {
1206 get
1207 {
1208 if (null != cloneFrom)
1209 return cloneFrom.DisabledButtonsStyle;
1210 object obj = ViewState["DisabledButtonsStyle"];
1211 return (null == obj) ? DisabledButtonsStyle : (string)obj;
1212 }
1213 set
1214 {
1215 ViewState["DisabledButtonsStyle"] = value;
1216 }
1217 }
1218 */
1219 #endregion
1220
1221 #region Others
1222
1223 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="CloneFrom"]/*'/>
1224 [Browsable(true), Themeable(false), TypeConverter(typeof(AspNetPagerIDConverter)), Category("Behavior"), DefaultValue(false), ANPDescription("desc_CloneFrom")]
1225 public string CloneFrom
1226 {
1227 get
1228 {
1229 return (string)ViewState["CloneFrom"];
1230 }
1231 set
1232 {
1233 if (null != value && String.Empty == value.Trim())
1234 throw new ArgumentNullException("CloneFrom", "The Value of property CloneFrom can not be empty string!");
1235 if (ID.Equals(value, StringComparison.OrdinalIgnoreCase))
1236 throw new ArgumentException("The property value of CloneFrom can not be set to control itself!", "CloneFrom");
1237 ViewState["CloneFrom"] = value;
1238 }
1239 }
1240
1241 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="EnableTheming"]/*'/>
1242 public override bool EnableTheming
1243 {
1244 get
1245 {
1246 if (null != cloneFrom)
1247 return cloneFrom.EnableTheming;
1248 return base.EnableTheming;
1249 }
1250 set
1251 {
1252 base.EnableTheming = value;
1253 }
1254 }
1255
1256 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="SkinID"]/*'/>
1257 public override string SkinID
1258 {
1259 get
1260 {
1261 if (null != cloneFrom)
1262 return cloneFrom.SkinID;
1263 return base.SkinID;
1264 }
1265 set
1266 {
1267 base.SkinID = value;
1268 }
1269 }
1270
1271 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="EnableUrlRewriting"]/*'/>
1272 [Browsable(true), Themeable(true), Category("Behavior"), DefaultValue(false), ANPDescription("desc_EnableUrlWriting")]
1273 public bool EnableUrlRewriting
1274 {
1275 get
1276 {
1277 object obj = ViewState["UrlRewriting"];
1278 if (null == obj)
1279 {
1280 if (null != cloneFrom)
1281 return cloneFrom.EnableUrlRewriting;
1282 return false;
1283 }
1284 return (bool)obj;
1285 }
1286 set
1287 {
1288 ViewState["UrlRewriting"] = value;
1289 if (value)
1290 UrlPaging = true;
1291 }
1292 }
1293
1294 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="UrlRewritePattern"]/*'/>
1295 [Browsable(true), Themeable(true), Category("Behavior"), DefaultValue(null), ANPDescription("desc_UrlRewritePattern")]
1296 public string UrlRewritePattern
1297 {
1298 get
1299 {
1300 object obj = ViewState["URPattern"];
1301 if (null == obj)
1302 {
1303 if (null != cloneFrom)
1304 return cloneFrom.UrlRewritePattern;
1305 if (EnableUrlRewriting)
1306 {
1307 if (!DesignMode)
1308 {
1309 string filePath = Page.Request.FilePath;
1310 return Path.GetFileNameWithoutExtension(filePath) + "_{0}" + Path.GetExtension(filePath);
1311 }
1312 }
1313 return null;
1314 }
1315 return (string)obj;
1316 }
1317 set
1318 {
1319 ViewState["URPattern"] = value;
1320 }
1321 }
1322
1323 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="AlwaysShow"]/*'/>
1324 [Browsable(true), Themeable(true), Category("Behavior"), DefaultValue(false), ANPDescription("desc_AlwaysShow")]
1325 public bool AlwaysShow
1326 {
1327 get
1328 {
1329 object obj = ViewState["AlwaysShow"];
1330 if (null == obj)
1331 {
1332 if (null != cloneFrom)
1333 return cloneFrom.AlwaysShow;
1334 return false;
1335 }
1336 return (bool)obj;
1337 }
1338 set
1339 {
1340 ViewState["AlwaysShow"] = value;
1341 }
1342 }
1343
1344 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="AlwaysShowFirstLastPageNumber"]/*'/>
1345 [Browsable(true), Themeable(true), Category("Behavior"), DefaultValue(false), ANPDescription("desc_AlwaysShowFirstLastPageNumber")]
1346 public bool AlwaysShowFirstLastPageNumber
1347 {
1348 get
1349 {
1350 object obj = ViewState["AlwaysShowFirstLastPageNumber"];
1351 if (null == obj)
1352 {
1353 if (null != cloneFrom)
1354 return cloneFrom.AlwaysShowFirstLastPageNumber;
1355 return false;
1356 }
1357 return (bool)obj;
1358 }
1359 set
1360 {
1361 ViewState["AlwaysShowFirstLastPageNumber"] = value;
1362 }
1363 }
1364
1365 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="Wrap"]/*'/>
1366 public override bool Wrap
1367 {
1368 get
1369 {
1370 return base.Wrap;
1371 }
1372 set
1373 {
1374 base.Wrap = false;
1375 }
1376 }
1377
1378 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="PageIndexOutOfRangeErrorMessage"]/*'/>
1379 [Browsable(true), Themeable(true), ANPDescription("desc_PIOutOfRangeMsg"), ANPDefaultValue("def_PIOutOfRangerMsg"), Category("Data")]
1380 public string PageIndexOutOfRangeErrorMessage
1381 {
1382 get
1383 {
1384 object obj = ViewState["PIOutOfRangeErrorMsg"];
1385 if (null == obj)
1386 {
1387 if (null != cloneFrom)
1388 return cloneFrom.PageIndexOutOfRangeErrorMessage;
1389 return SR.GetString("def_PIOutOfRangerMsg");
1390 }
1391 return (string)obj;
1392 }
1393 set
1394 {
1395 ViewState["PIOutOfRangeErrorMsg"] = value;
1396 }
1397 }
1398
1399 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="InvalidPageIndexErrorMessage"]/*'/>
1400 [Browsable(true), Themeable(true), ANPDescription("desc_InvalidPIErrorMsg"), ANPDefaultValue("def_InvalidPIErrorMsg"), Category("Data")]
1401 public string InvalidPageIndexErrorMessage
1402 {
1403 get
1404 {
1405 object obj = ViewState["InvalidPIErrorMsg"];
1406 if (null == obj)
1407 {
1408 if (null != cloneFrom)
1409 return cloneFrom.InvalidPageIndexErrorMessage;
1410 return SR.GetString("def_InvalidPIErrorMsg");
1411 }
1412 return (string)obj;
1413 }
1414 set
1415 {
1416 ViewState["InvalidPIErrorMsg"] = value;
1417 }
1418 }
1419
1420
1421 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="LayoutType"]/*'/>
1422 [Browsable(true), Themeable(true), ANPDescription("desc_LayoutType"), ANPDefaultValue("Div"), Category("Appearance")]
1423 public LayoutType LayoutType
1424 {
1425 get
1426 {
1427 if (null != cloneFrom)
1428 return cloneFrom.LayoutType;
1429 object obj = ViewState["LayoutType"];
1430 return (null == obj) ? LayoutType.Div : (LayoutType)obj;
1431 }
1432 set { ViewState["LayoutType"] = value; }
1433 }
1434
1435 #endregion
1436 }
1437 }