Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / xsp / System / Web / UI / WebControls / PagerSettings.cs / 1 / PagerSettings.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.Security.Permissions;
///
/// Specifies the pager setting for the control. This class cannot be inherited.
///
[TypeConverter(typeof(ExpandableObjectConverter))]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class PagerSettings : IStateManager {
private StateBag _viewState;
private bool _isTracking;
[
Browsable(false)
]
public event EventHandler PropertyChanged;
///
/// Creates a new instance of PagerSettings.
///
public PagerSettings() {
_viewState = new StateBag();
}
///
/// Gets or sets the image path to be used for the First
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue(""),
NotifyParentProperty(true),
Editor("System.Web.UI.Design.ImageUrlEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor)),
UrlProperty(),
WebSysDescription(SR.PagerSettings_FirstPageImageUrl)
]
public string FirstPageImageUrl {
get {
object o = ViewState["FirstPageImageUrl"];
if (o != null) {
return(string)o;
}
return String.Empty;
}
set {
string oldValue = FirstPageImageUrl;
if (oldValue != value) {
ViewState["FirstPageImageUrl"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the text to be used for the First page
/// button.
///
[
WebCategory("Appearance"),
DefaultValue("<<"),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_FirstPageText)
]
public string FirstPageText {
get {
object o = ViewState["FirstPageText"];
if (o != null) {
return(string)o;
}
return "<<";
}
set {
string oldValue = FirstPageText;
if (oldValue != value) {
ViewState["FirstPageText"] = value;
OnPropertyChanged();
}
}
}
///
///
internal bool IsPagerOnBottom {
get {
PagerPosition position = Position;
return(position == PagerPosition.Bottom) ||
(position == PagerPosition.TopAndBottom);
}
}
///
///
internal bool IsPagerOnTop {
get {
PagerPosition position = Position;
return(position == PagerPosition.Top) ||
(position == PagerPosition.TopAndBottom);
}
}
///
/// Gets or sets the image path to be used for the Last
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue(""),
NotifyParentProperty(true),
Editor("System.Web.UI.Design.ImageUrlEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor)),
UrlProperty(),
WebSysDescription(SR.PagerSettings_LastPageImageUrl)
]
public string LastPageImageUrl {
get {
object o = ViewState["LastPageImageUrl"];
if (o != null) {
return(string)o;
}
return String.Empty;
}
set {
string oldValue = LastPageImageUrl;
if (oldValue != value) {
ViewState["LastPageImageUrl"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the text to be used for the Last page
/// button.
///
[
WebCategory("Appearance"),
DefaultValue(">>"),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_LastPageText)
]
public string LastPageText {
get {
object o = ViewState["LastPageText"];
if (o != null) {
return(string)o;
}
return ">>";
}
set {
string oldValue = LastPageText;
if (oldValue != value) {
ViewState["LastPageText"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the type of Paging UI to use.
///
[
WebCategory("Appearance"),
DefaultValue(PagerButtons.Numeric),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_Mode)
]
public PagerButtons Mode {
get {
object o = ViewState["PagerMode"];
if (o != null) {
return(PagerButtons)o;
}
return PagerButtons.Numeric;
}
set {
if (value < PagerButtons.NextPrevious || value > PagerButtons.NumericFirstLast) {
throw new ArgumentOutOfRangeException("value");
}
PagerButtons oldValue = Mode;
if (oldValue != value) {
ViewState["PagerMode"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the image path to be used for the Next
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue(""),
NotifyParentProperty(true),
Editor("System.Web.UI.Design.ImageUrlEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor)),
UrlProperty(),
WebSysDescription(SR.PagerSettings_NextPageImageUrl)
]
public string NextPageImageUrl {
get {
object o = ViewState["NextPageImageUrl"];
if (o != null) {
return(string)o;
}
return String.Empty;
}
set {
string oldValue = NextPageImageUrl;
if (oldValue != value) {
ViewState["NextPageImageUrl"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the text to be used for the Next page
/// button.
///
[
WebCategory("Appearance"),
DefaultValue(">"),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_NextPageText)
]
public string NextPageText {
get {
object o = ViewState["NextPageText"];
if (o != null) {
return(string)o;
}
return ">";
}
set {
string oldValue = NextPageText;
if (oldValue != value) {
ViewState["NextPageText"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the number of pages to show in the
/// paging UI when the mode is
/// .
///
[
WebCategory("Behavior"),
DefaultValue(10),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_PageButtonCount)
]
public int PageButtonCount {
get {
object o = ViewState["PageButtonCount"];
if (o != null) {
return(int)o;
}
return 10;
}
set {
if (value < 1) {
throw new ArgumentOutOfRangeException("value");
}
int oldValue = PageButtonCount;
if (oldValue != value) {
ViewState["PageButtonCount"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the vertical
/// position of the paging UI bar with
/// respect to its associated control.
///
[
WebCategory("Layout"),
DefaultValue(PagerPosition.Bottom),
NotifyParentProperty(true),
WebSysDescription(SR.PagerStyle_Position)
]
public PagerPosition Position {
get {
object o = ViewState["Position"];
if (o != null) {
return(PagerPosition)o;
}
return PagerPosition.Bottom;
}
set {
if (value < PagerPosition.Bottom || value > PagerPosition.TopAndBottom) {
throw new ArgumentOutOfRangeException("value");
}
ViewState["Position"] = value;
}
}
///
/// Gets or sets the image path to be used for the Previous
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue(""),
NotifyParentProperty(true),
Editor("System.Web.UI.Design.ImageUrlEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor)),
UrlProperty(),
WebSysDescription(SR.PagerSettings_PreviousPageImageUrl)
]
public string PreviousPageImageUrl {
get {
object o = ViewState["PreviousPageImageUrl"];
if (o != null) {
return(string)o;
}
return String.Empty;
}
set {
string oldValue = PreviousPageImageUrl;
if (oldValue != value) {
ViewState["PreviousPageImageUrl"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the text to be used for the Previous
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue("<"),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_PreviousPageText)
]
public string PreviousPageText {
get {
object o = ViewState["PreviousPageText"];
if (o != null) {
return(string)o;
}
return "<";
}
set {
string oldValue = PreviousPageText;
if (oldValue != value) {
ViewState["PreviousPageText"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or set whether the paging
/// UI is to be shown.
///
[
WebCategory("Appearance"),
DefaultValue(true),
NotifyParentProperty(true),
WebSysDescription(SR.PagerStyle_Visible)
]
public bool Visible {
get {
object o = ViewState["PagerVisible"];
if (o != null) {
return(bool)o;
}
return true;
}
set {
ViewState["PagerVisible"] = value;
}
}
///
/// Gets the statebag for the PagerSettings. This property is read-only.
///
private StateBag ViewState {
get {
return _viewState;
}
}
///
/// DataBound Controls use this event to rebind when settings have changed.
///
void OnPropertyChanged() {
if (PropertyChanged != null) {
PropertyChanged(this, EventArgs.Empty);
}
}
///
/// The propertyGrid uses ToString() to determine what text should be in the PagerSetting's edit box.
///
public override string ToString() {
return String.Empty;
}
#region IStateManager implementation
///
bool IStateManager.IsTrackingViewState {
get {
return _isTracking;
}
}
///
void IStateManager.LoadViewState(object state) {
if (state != null) {
((IStateManager)ViewState).LoadViewState(state);
}
}
///
object IStateManager.SaveViewState() {
object state = ((IStateManager)ViewState).SaveViewState();
return state;
}
///
void IStateManager.TrackViewState() {
_isTracking = true;
ViewState.TrackViewState();
}
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.WebControls {
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.Security.Permissions;
///
/// Specifies the pager setting for the control. This class cannot be inherited.
///
[TypeConverter(typeof(ExpandableObjectConverter))]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class PagerSettings : IStateManager {
private StateBag _viewState;
private bool _isTracking;
[
Browsable(false)
]
public event EventHandler PropertyChanged;
///
/// Creates a new instance of PagerSettings.
///
public PagerSettings() {
_viewState = new StateBag();
}
///
/// Gets or sets the image path to be used for the First
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue(""),
NotifyParentProperty(true),
Editor("System.Web.UI.Design.ImageUrlEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor)),
UrlProperty(),
WebSysDescription(SR.PagerSettings_FirstPageImageUrl)
]
public string FirstPageImageUrl {
get {
object o = ViewState["FirstPageImageUrl"];
if (o != null) {
return(string)o;
}
return String.Empty;
}
set {
string oldValue = FirstPageImageUrl;
if (oldValue != value) {
ViewState["FirstPageImageUrl"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the text to be used for the First page
/// button.
///
[
WebCategory("Appearance"),
DefaultValue("<<"),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_FirstPageText)
]
public string FirstPageText {
get {
object o = ViewState["FirstPageText"];
if (o != null) {
return(string)o;
}
return "<<";
}
set {
string oldValue = FirstPageText;
if (oldValue != value) {
ViewState["FirstPageText"] = value;
OnPropertyChanged();
}
}
}
///
///
internal bool IsPagerOnBottom {
get {
PagerPosition position = Position;
return(position == PagerPosition.Bottom) ||
(position == PagerPosition.TopAndBottom);
}
}
///
///
internal bool IsPagerOnTop {
get {
PagerPosition position = Position;
return(position == PagerPosition.Top) ||
(position == PagerPosition.TopAndBottom);
}
}
///
/// Gets or sets the image path to be used for the Last
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue(""),
NotifyParentProperty(true),
Editor("System.Web.UI.Design.ImageUrlEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor)),
UrlProperty(),
WebSysDescription(SR.PagerSettings_LastPageImageUrl)
]
public string LastPageImageUrl {
get {
object o = ViewState["LastPageImageUrl"];
if (o != null) {
return(string)o;
}
return String.Empty;
}
set {
string oldValue = LastPageImageUrl;
if (oldValue != value) {
ViewState["LastPageImageUrl"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the text to be used for the Last page
/// button.
///
[
WebCategory("Appearance"),
DefaultValue(">>"),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_LastPageText)
]
public string LastPageText {
get {
object o = ViewState["LastPageText"];
if (o != null) {
return(string)o;
}
return ">>";
}
set {
string oldValue = LastPageText;
if (oldValue != value) {
ViewState["LastPageText"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the type of Paging UI to use.
///
[
WebCategory("Appearance"),
DefaultValue(PagerButtons.Numeric),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_Mode)
]
public PagerButtons Mode {
get {
object o = ViewState["PagerMode"];
if (o != null) {
return(PagerButtons)o;
}
return PagerButtons.Numeric;
}
set {
if (value < PagerButtons.NextPrevious || value > PagerButtons.NumericFirstLast) {
throw new ArgumentOutOfRangeException("value");
}
PagerButtons oldValue = Mode;
if (oldValue != value) {
ViewState["PagerMode"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the image path to be used for the Next
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue(""),
NotifyParentProperty(true),
Editor("System.Web.UI.Design.ImageUrlEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor)),
UrlProperty(),
WebSysDescription(SR.PagerSettings_NextPageImageUrl)
]
public string NextPageImageUrl {
get {
object o = ViewState["NextPageImageUrl"];
if (o != null) {
return(string)o;
}
return String.Empty;
}
set {
string oldValue = NextPageImageUrl;
if (oldValue != value) {
ViewState["NextPageImageUrl"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the text to be used for the Next page
/// button.
///
[
WebCategory("Appearance"),
DefaultValue(">"),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_NextPageText)
]
public string NextPageText {
get {
object o = ViewState["NextPageText"];
if (o != null) {
return(string)o;
}
return ">";
}
set {
string oldValue = NextPageText;
if (oldValue != value) {
ViewState["NextPageText"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the number of pages to show in the
/// paging UI when the mode is
/// .
///
[
WebCategory("Behavior"),
DefaultValue(10),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_PageButtonCount)
]
public int PageButtonCount {
get {
object o = ViewState["PageButtonCount"];
if (o != null) {
return(int)o;
}
return 10;
}
set {
if (value < 1) {
throw new ArgumentOutOfRangeException("value");
}
int oldValue = PageButtonCount;
if (oldValue != value) {
ViewState["PageButtonCount"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the vertical
/// position of the paging UI bar with
/// respect to its associated control.
///
[
WebCategory("Layout"),
DefaultValue(PagerPosition.Bottom),
NotifyParentProperty(true),
WebSysDescription(SR.PagerStyle_Position)
]
public PagerPosition Position {
get {
object o = ViewState["Position"];
if (o != null) {
return(PagerPosition)o;
}
return PagerPosition.Bottom;
}
set {
if (value < PagerPosition.Bottom || value > PagerPosition.TopAndBottom) {
throw new ArgumentOutOfRangeException("value");
}
ViewState["Position"] = value;
}
}
///
/// Gets or sets the image path to be used for the Previous
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue(""),
NotifyParentProperty(true),
Editor("System.Web.UI.Design.ImageUrlEditor, " + AssemblyRef.SystemDesign, typeof(UITypeEditor)),
UrlProperty(),
WebSysDescription(SR.PagerSettings_PreviousPageImageUrl)
]
public string PreviousPageImageUrl {
get {
object o = ViewState["PreviousPageImageUrl"];
if (o != null) {
return(string)o;
}
return String.Empty;
}
set {
string oldValue = PreviousPageImageUrl;
if (oldValue != value) {
ViewState["PreviousPageImageUrl"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or sets the text to be used for the Previous
/// page button.
///
[
WebCategory("Appearance"),
DefaultValue("<"),
NotifyParentProperty(true),
WebSysDescription(SR.PagerSettings_PreviousPageText)
]
public string PreviousPageText {
get {
object o = ViewState["PreviousPageText"];
if (o != null) {
return(string)o;
}
return "<";
}
set {
string oldValue = PreviousPageText;
if (oldValue != value) {
ViewState["PreviousPageText"] = value;
OnPropertyChanged();
}
}
}
///
/// Gets or set whether the paging
/// UI is to be shown.
///
[
WebCategory("Appearance"),
DefaultValue(true),
NotifyParentProperty(true),
WebSysDescription(SR.PagerStyle_Visible)
]
public bool Visible {
get {
object o = ViewState["PagerVisible"];
if (o != null) {
return(bool)o;
}
return true;
}
set {
ViewState["PagerVisible"] = value;
}
}
///
/// Gets the statebag for the PagerSettings. This property is read-only.
///
private StateBag ViewState {
get {
return _viewState;
}
}
///
/// DataBound Controls use this event to rebind when settings have changed.
///
void OnPropertyChanged() {
if (PropertyChanged != null) {
PropertyChanged(this, EventArgs.Empty);
}
}
///
/// The propertyGrid uses ToString() to determine what text should be in the PagerSetting's edit box.
///
public override string ToString() {
return String.Empty;
}
#region IStateManager implementation
///
bool IStateManager.IsTrackingViewState {
get {
return _isTracking;
}
}
///
void IStateManager.LoadViewState(object state) {
if (state != null) {
((IStateManager)ViewState).LoadViewState(state);
}
}
///
object IStateManager.SaveViewState() {
object state = ((IStateManager)ViewState).SaveViewState();
return state;
}
///
void IStateManager.TrackViewState() {
_isTracking = true;
ViewState.TrackViewState();
}
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextLine.cs
- DecimalFormatter.cs
- QueryCacheEntry.cs
- PageParserFilter.cs
- DynamicResourceExtension.cs
- FileUtil.cs
- DecimalAnimation.cs
- RtfFormatStack.cs
- ForEachAction.cs
- DataViewManagerListItemTypeDescriptor.cs
- DataSourceViewSchemaConverter.cs
- ZipIOExtraFieldZip64Element.cs
- PrintPageEvent.cs
- ConfigurationManager.cs
- XmlSchemaComplexContentRestriction.cs
- DriveNotFoundException.cs
- ServiceOperation.cs
- BitmapData.cs
- CustomCategoryAttribute.cs
- CodeRemoveEventStatement.cs
- ManifestSignedXml.cs
- TryExpression.cs
- AtlasWeb.Designer.cs
- XmlSignificantWhitespace.cs
- QilChoice.cs
- WebZone.cs
- GroupAggregateExpr.cs
- SmiEventSink.cs
- FrameworkElement.cs
- HostingEnvironmentWrapper.cs
- Partitioner.cs
- TextAction.cs
- XPathNodeInfoAtom.cs
- DbConnectionPoolGroupProviderInfo.cs
- _SSPISessionCache.cs
- DateTimeSerializationSection.cs
- GridViewRowPresenter.cs
- ErrorInfoXmlDocument.cs
- HttpModuleCollection.cs
- UnsafeNativeMethods.cs
- IPAddressCollection.cs
- LockCookie.cs
- DBPropSet.cs
- Int64KeyFrameCollection.cs
- LinqDataSourceContextEventArgs.cs
- RoleManagerSection.cs
- BaseConfigurationRecord.cs
- precedingsibling.cs
- InvalidOleVariantTypeException.cs
- Exception.cs
- TogglePattern.cs
- CodePropertyReferenceExpression.cs
- MessageHeaderDescriptionCollection.cs
- BmpBitmapEncoder.cs
- BitmapMetadataBlob.cs
- ExpressionVisitorHelpers.cs
- _SSPIWrapper.cs
- XmlDeclaration.cs
- HostingEnvironmentWrapper.cs
- MLangCodePageEncoding.cs
- DoubleLinkListEnumerator.cs
- IMembershipProvider.cs
- WebPartCloseVerb.cs
- WithStatement.cs
- TabletCollection.cs
- storagemappingitemcollection.viewdictionary.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- TrackingValidationObjectDictionary.cs
- WebBrowserPermission.cs
- GreenMethods.cs
- KnownTypes.cs
- NodeFunctions.cs
- IsolatedStorageException.cs
- DataFormats.cs
- CompilationUtil.cs
- NamedPermissionSet.cs
- PenCursorManager.cs
- DoubleAnimationBase.cs
- _AutoWebProxyScriptEngine.cs
- TemplateBuilder.cs
- sqlcontext.cs
- FactoryGenerator.cs
- ArgumentNullException.cs
- SqlDeflator.cs
- _UriSyntax.cs
- CompilerScopeManager.cs
- WebServicesInteroperability.cs
- SystemKeyConverter.cs
- DesignerHelpers.cs
- PeerCollaboration.cs
- HatchBrush.cs
- ResourcePart.cs
- TimeZoneInfo.cs
- Type.cs
- DataViewManager.cs
- ScriptReference.cs
- GraphicsPathIterator.cs
- ProxyManager.cs
- DecoderBestFitFallback.cs
- DataGridCellClipboardEventArgs.cs