// Authors:
// Sanjay Gupta (gsanjay@novell.com)
//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System.IO;
using System.ComponentModel;
using System.Data.Common;
using System.Drawing;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
// attributes
[DesignerAttribute ("System.Web.UI.Design.WebControls.AccessDataSourceDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
[ToolboxBitmap ("")]
- public class AccessDataSource : SqlDataSource {
-
+ public class AccessDataSource : SqlDataSource
+ {
const string PROVIDER_NAME = "System.Data.OleDb";
const string PROVIDER_STRING = "Microsoft.Jet.OLEDB.4.0";
string GetPhysicalDataFilePath ()
{
- if (DataFile == null || DataFile == "")
- return "";
+ if (String.IsNullOrEmpty (DataFile))
+ return String.Empty;
// more here? how do we handle |DataDirectory|?
return HttpContext.Current.Request.MapPath (DataFile);
[WebSysDescriptionAttribute ("MS Office Access database file name")]
[EditorAttribute ("System.Web.UI.Design.MdbDataFileEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
public string DataFile {
- get { return ViewState.GetString ("DataFile", ""); }
+ get { return ViewState.GetString ("DataFile", String.Empty); }
set {
ViewState ["DataFile"] = value;
connectionString = null;
set { throw new InvalidOperationException
("Setting ProviderName on an AccessDataSource is not allowed");
}
- }
+ }
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Data.OleDb;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public class AccessDataSourceView : SqlDataSourceView {
-
+ public class AccessDataSourceView : SqlDataSourceView
+ {
OleDbConnection oleConnection;
OleDbCommand oleCommand;
AccessDataSource dataSource;
}
}
}
-#endif
+
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Collections;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
-#if NET_2_0
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public class AdCreatedEventArgs : EventArgs {
-#else
- public sealed class AdCreatedEventArgs : EventArgs {
-#endif
+ public class AdCreatedEventArgs : EventArgs
+ {
IDictionary properties;
string alt_text;
// Author:
// Ben Maurer <bmaurer@novell.com>
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Security.Permissions;
using System.Web.Util;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[DefaultEvent("AdCreated")]
[DefaultProperty("AdvertisementFile")]
[Designer("System.Web.UI.Design.WebControls.AdRotatorDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
-#if NET_2_0
[ToolboxData("<{0}:AdRotator runat=\"server\"></{0}:AdRotator>")]
-#else
- [ToolboxData("<{0}:AdRotator runat=\"server\" Height=\"60px\" Width=\"468px\"></{0}:AdRotator>")]
-#endif
- public class AdRotator :
-#if NET_2_0
- DataBoundControl
-#else
- WebControl
-#endif
+ public class AdRotator : DataBoundControl
{
-#if NET_2_0
+ AdCreatedEventArgs createdargs;
+ ArrayList ads = new ArrayList ();
+ string ad_file = String.Empty;
+
protected internal override void OnInit (EventArgs e)
{
base.OnInit(e);
}
-#endif
-
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void OnPreRender (EventArgs eee)
+
+ protected internal override void OnPreRender (EventArgs eee)
{
Hashtable ht = null;
- if (ad_file != "" && ad_file != null) {
- ReadAdsFromFile (
-#if NET_2_0
- GetPhysicalFilePath (ad_file)
-#else
- Page.MapPath (ad_file)
-#endif
- );
+ if (!String.IsNullOrEmpty (ad_file)) {
+ ReadAdsFromFile (GetPhysicalFilePath (ad_file));
ht = ChooseAd ();
}
}
-#if NET_2_0
[MonoTODO ("Not implemented")]
protected internal override void PerformDataBinding (IEnumerable data)
{
{
throw new NotImplementedException ();
}
-#endif
- AdCreatedEventArgs createdargs;
-
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void Render (HtmlTextWriter w)
+ protected internal override void Render (HtmlTextWriter w)
{
AdCreatedEventArgs e = createdargs;
if (e.ImageUrl != null && e.ImageUrl.Length > 0)
w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveAdUrl (e.ImageUrl));
- w.AddAttribute (HtmlTextWriterAttribute.Alt, e.AlternateText == null ? "" : e.AlternateText);
+ w.AddAttribute (HtmlTextWriterAttribute.Alt, e.AlternateText == null ? String.Empty : e.AlternateText);
w.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
w.RenderBeginTag (HtmlTextWriterTag.Img);
w.RenderEndTag (); // img
int total_imp = 0;
int cur_imp = 0;
+ bool keywordFilterEmpty = KeywordFilter.Length == 0;
foreach (Hashtable a in ads) {
- if (KeywordFilter == "" || KeywordFilter == (string) a ["Keyword"])
+ if (keywordFilterEmpty || KeywordFilter == (string) a ["Keyword"])
total_imp += a ["Impressions"] != null ? int.Parse ((string) a ["Impressions"]) : 1;
}
int r = new Random ().Next (total_imp);
foreach (Hashtable a in ads) {
- if (KeywordFilter != "" && KeywordFilter != (string) a ["Keyword"])
+ if (keywordFilterEmpty && KeywordFilter != (string) a ["Keyword"])
continue;
cur_imp += a ["Impressions"] != null ? int.Parse ((string) a ["Impressions"]) : 1;
return null;
}
-
- ArrayList ads = new ArrayList ();
void ReadAdsFromFile (string s)
{
ads.Add (ad);
}
}
-
- string ad_file = "";
-#if NET_2_0
+
[UrlProperty]
-#endif
[Bindable(true)]
[DefaultValue("")]
[Editor("System.Web.UI.Design.XmlUrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
}
-#if NET_2_0
[DefaultValue ("AlternateText")]
[WebSysDescriptionAttribute ("")]
[WebCategoryAttribute ("Behavior")]
throw new NotImplementedException ();
}
}
-#endif
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
}
}
-#if NET_2_0
[DefaultValue ("ImageUrl")]
[MonoTODO ("Not implemented")]
[WebSysDescriptionAttribute ("")]
throw new NotImplementedException ();
}
}
-#endif
-
[Bindable(true)]
[DefaultValue("")]
[WebCategory("Behavior")]
public string KeywordFilter {
get {
- return ViewState.GetString ("KeywordFilter", "");
+ return ViewState.GetString ("KeywordFilter", String.Empty);
}
set {
ViewState ["KeywordFilter"] = value;
}
-#if NET_2_0
[DefaultValue ("NavigateUrl")]
[MonoTODO ("Not implemented")]
[WebSysDescriptionAttribute ("")]
throw new NotImplementedException ();
}
}
-#endif
[Bindable(true)]
[DefaultValue("_top")]
}
-#if NET_2_0
/* all these are listed in corcompare */
public override string UniqueID
{
return base.TagKey;
}
}
-#endif
protected virtual void OnAdCreated (AdCreatedEventArgs e)
{
// Authors:
// Sanjay Gupta (gsanjay@novell.com)
//
-// (C) 2004 Novell, Inc (http://www.novell.com)
+// (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-
-#if NET_2_0
using System;
namespace System.Web.UI.WebControls
}
}
}
-#endif
+
// Authors:
// Sanjay Gupta (gsanjay@novell.com)
//
-// (C) 2004 Novell, Inc (http://www.novell.com)
+// (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
//
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-namespace System.Web.UI.WebControls {
+
+namespace System.Web.UI.WebControls
+{
public class AuthenticateEventArgs : EventArgs
{
bool authenticated;
}
}
}
-#endif
+
// Authors:
// Sanjay Gupta (gsanjay@novell.com)
//
-// (C) 2004 Novell, Inc (http://www.novell.com)
+// (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
//
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-namespace System.Web.UI.WebControls {
+namespace System.Web.UI.WebControls
+{
public delegate void AuthenticateEventHandler (object sender, AuthenticateEventArgs e);
}
-#endif
+
// Authors:
// Sanjay Gupta (gsanjay@novell.com)
//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-namespace System.Web.UI.WebControls {
- public enum AutoCompleteType {
+namespace System.Web.UI.WebControls
+{
+ public enum AutoCompleteType
+ {
None = 0,
Disabled = 1,
Cellular = 2,
Search = 31,
}
}
-#endif
+
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Web.UI;
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[EditorBrowsableAttribute (EditorBrowsableState.Never)]
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
}
}
}
-#endif
+
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Web.UI;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class AutoGeneratedFieldProperties: IStateManager
StateBag ViewState = new StateBag ();
public string DataField {
- get { return ViewState.GetString ("DataField", ""); }
+ get { return ViewState.GetString ("DataField", String.Empty); }
set { ViewState ["DataField"] = value; }
}
}
public string Name {
- get { return ViewState.GetString ("Name", ""); }
+ get { return ViewState.GetString ("Name", String.Empty); }
set { ViewState ["Name"] = value; }
}
}
}
}
-#endif
+
// Authors:
// Chris Toshok (toshok@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Security.Permissions;
using System.Web.Util;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public abstract class BaseCompareValidator : BaseValidator {
-
-#if NET_2_0
- protected
-#else
- public
-#endif
- BaseCompareValidator ()
+ public abstract class BaseCompareValidator : BaseValidator
+ {
+ protected BaseCompareValidator ()
{
}
protected override void AddAttributesToRender (HtmlTextWriter w)
{
if (RenderUplevel) {
-#if NET_2_0
- if (Page!=null){
+ if (Page != null) {
RegisterExpandoAttribute (ClientID, "type", Type.ToString ());
switch (Type) {
- case ValidationDataType.Date:
- DateTimeFormatInfo dateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat;
- string pattern = dateTimeFormat.ShortDatePattern;
- string dateorder = (pattern.StartsWith ("y", true, Helpers.InvariantCulture) ? "ymd" : (pattern.StartsWith ("m", true, Helpers.InvariantCulture) ? "mdy" : "dmy"));
- RegisterExpandoAttribute (ClientID, "dateorder", dateorder);
- RegisterExpandoAttribute (ClientID, "cutoffyear", dateTimeFormat.Calendar.TwoDigitYearMax.ToString ());
- break;
- case ValidationDataType.Currency:
- NumberFormatInfo numberFormat = CultureInfo.CurrentCulture.NumberFormat;
- RegisterExpandoAttribute (ClientID, "decimalchar", numberFormat.CurrencyDecimalSeparator, true);
- RegisterExpandoAttribute (ClientID, "groupchar", numberFormat.CurrencyGroupSeparator, true);
- RegisterExpandoAttribute (ClientID, "digits", numberFormat.CurrencyDecimalDigits.ToString());
- RegisterExpandoAttribute (ClientID, "groupsize", numberFormat.CurrencyGroupSizes [0].ToString ());
- break;
+ case ValidationDataType.Date:
+ DateTimeFormatInfo dateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat;
+ string pattern = dateTimeFormat.ShortDatePattern;
+ string dateorder = (pattern.StartsWith ("y", true, Helpers.InvariantCulture) ? "ymd" : (pattern.StartsWith ("m", true, Helpers.InvariantCulture) ? "mdy" : "dmy"));
+ RegisterExpandoAttribute (ClientID, "dateorder", dateorder);
+ RegisterExpandoAttribute (ClientID, "cutoffyear", dateTimeFormat.Calendar.TwoDigitYearMax.ToString ());
+ break;
+ case ValidationDataType.Currency:
+ NumberFormatInfo numberFormat = CultureInfo.CurrentCulture.NumberFormat;
+ RegisterExpandoAttribute (ClientID, "decimalchar", numberFormat.CurrencyDecimalSeparator, true);
+ RegisterExpandoAttribute (ClientID, "groupchar", numberFormat.CurrencyGroupSeparator, true);
+ RegisterExpandoAttribute (ClientID, "digits", numberFormat.CurrencyDecimalDigits.ToString());
+ RegisterExpandoAttribute (ClientID, "groupsize", numberFormat.CurrencyGroupSizes [0].ToString ());
+ break;
}
}
-#else
- w.AddAttribute ("datatype", Type.ToString());
-#endif
}
base.AddAttributesToRender (w);
return BaseCompareValidator.Convert(text, type, false, out value);
}
- protected static bool Compare (string left,
- string right,
- ValidationCompareOperator op,
- ValidationDataType type)
+ protected static bool Compare (string left, string right, ValidationCompareOperator op, ValidationDataType type)
{
return BaseCompareValidator.Compare(left, false, right, false, op, type);
}
if (c == 'm') {
if (!seen_month) order.Append ("m");
seen_month = true;
- }
- else if (c == 'y') {
+ } else if (c == 'y') {
if (!seen_year) order.Append ("y");
seen_year = true;
- }
- else /* (c == 'd') */ {
+ } else /* (c == 'd') */ {
if (!seen_date) order.Append ("d");
seen_date = true;
}
protected static int GetFullYear (int two_digit_year)
{
-#if NET_2_0
/* This is an implementation that matches the
* docs on msdn, but MS doesn't seem to go by
* their docs (at least in 1.0). */
int cutoff = CutoffYear;
int twodigitcutoff = cutoff % 100;
- if (two_digit_year <= twodigitcutoff) {
+ if (two_digit_year <= twodigitcutoff)
return cutoff - twodigitcutoff + two_digit_year;
- }
- else {
+ else
return cutoff - twodigitcutoff - 100 + two_digit_year;
- }
-#else
- /* This is the broken implementation in 1.0 */
- int cutoff = CutoffYear;
- int twodigitcutoff = cutoff % 100;
-
- return cutoff - twodigitcutoff + two_digit_year;
-#endif
}
-#if NET_2_0
[DefaultValue (false)]
[Themeable (false)]
- public
-#else
- internal
-#endif
- bool CultureInvariantValues {
+ public bool CultureInvariantValues {
get { return ViewState.GetBool ("CultureInvariantValues", false); }
set { ViewState ["CultureInvariantValues"] = value; }
}
-
-
protected static int CutoffYear {
- get {
- return CultureInfo.CurrentCulture.Calendar.TwoDigitYearMax;
- }
+ get { return CultureInfo.CurrentCulture.Calendar.TwoDigitYearMax; }
}
[DefaultValue(ValidationDataType.String)]
-#if NET_2_0
[Themeable (false)]
-#endif
[WebSysDescription("")]
[WebCategory("Behavior")]
public ValidationDataType Type {
set { ViewState ["Type"] = value; }
}
-#if NET_2_0
-
- public
-#else
- internal
-#endif
- static bool CanConvert (string text,
- ValidationDataType type,
- bool cultureInvariant)
+ public static bool CanConvert (string text, ValidationDataType type, bool cultureInvariant)
{
object value;
return Convert(text, type, cultureInvariant, out value);
}
-#if NET_2_0
- protected
-#else
- internal
-#endif
- static bool Compare (string left,
+ protected static bool Compare (string left,
bool cultureInvariantLeftText,
string right,
bool cultureInvariantRightText,
ValidationCompareOperator op,
ValidationDataType type)
{
- object lo, ro;
-
- if (!Convert(left, type, cultureInvariantLeftText, out lo))
- return false;
-
- /* DataTypeCheck is a unary operator that only
- * depends on the lhs */
- if (op == ValidationCompareOperator.DataTypeCheck)
- return true;
-
- /* pretty crackladen, but if we're unable to
- * convert the rhs to @type, the comparison
- * succeeds */
- if (!Convert(right, type, cultureInvariantRightText, out ro))
- return true;
-
- int comp = ((IComparable)lo).CompareTo((IComparable)ro);
-
- switch (op)
- {
- case ValidationCompareOperator.Equal:
- return comp == 0;
- case ValidationCompareOperator.NotEqual:
- return comp != 0;
- case ValidationCompareOperator.LessThan:
- return comp < 0;
- case ValidationCompareOperator.LessThanEqual:
- return comp <= 0;
- case ValidationCompareOperator.GreaterThan:
- return comp > 0;
- case ValidationCompareOperator.GreaterThanEqual:
- return comp >= 0;
- default:
- return false;
- }
+ object lo, ro;
+
+ if (!Convert(left, type, cultureInvariantLeftText, out lo))
+ return false;
+
+ /* DataTypeCheck is a unary operator that only
+ * depends on the lhs */
+ if (op == ValidationCompareOperator.DataTypeCheck)
+ return true;
+
+ /* pretty crackladen, but if we're unable to
+ * convert the rhs to @type, the comparison
+ * succeeds */
+ if (!Convert(right, type, cultureInvariantRightText, out ro))
+ return true;
+
+ int comp = ((IComparable)lo).CompareTo((IComparable)ro);
+
+ switch (op) {
+ case ValidationCompareOperator.Equal:
+ return comp == 0;
+ case ValidationCompareOperator.NotEqual:
+ return comp != 0;
+ case ValidationCompareOperator.LessThan:
+ return comp < 0;
+ case ValidationCompareOperator.LessThanEqual:
+ return comp <= 0;
+ case ValidationCompareOperator.GreaterThan:
+ return comp > 0;
+ case ValidationCompareOperator.GreaterThanEqual:
+ return comp >= 0;
+ default:
+ return false;
+ }
}
-#if NET_2_0
- protected
-#else
- internal
-#endif
- static bool Convert (string text,
- ValidationDataType type,
- bool cultureInvariant,
- out object value)
+ protected static bool Convert (string text, ValidationDataType type, bool cultureInvariant,out object value)
{
- try
- {
- switch (type)
- {
- case ValidationDataType.String:
- value = text;
- return value != null;
-
- case ValidationDataType.Integer:
- IFormatProvider intFormatProvider = (cultureInvariant) ?
- NumberFormatInfo.InvariantInfo :
- NumberFormatInfo.CurrentInfo;
- value = Int32.Parse(text, intFormatProvider);
- return true;
-
- case ValidationDataType.Double:
- IFormatProvider doubleFormatProvider = (cultureInvariant) ?
- NumberFormatInfo.InvariantInfo :
- NumberFormatInfo.CurrentInfo;
- value = Double.Parse(text, doubleFormatProvider);
- return true;
-
- case ValidationDataType.Date:
+ try {
+ switch (type) {
+ case ValidationDataType.String:
+ value = text;
+ return value != null;
+
+ case ValidationDataType.Integer:
+ IFormatProvider intFormatProvider = (cultureInvariant) ? NumberFormatInfo.InvariantInfo :
+ NumberFormatInfo.CurrentInfo;
+ value = Int32.Parse(text, intFormatProvider);
+ return true;
+
+ case ValidationDataType.Double:
+ IFormatProvider doubleFormatProvider = (cultureInvariant) ? NumberFormatInfo.InvariantInfo :
+ NumberFormatInfo.CurrentInfo;
+ value = Double.Parse(text, doubleFormatProvider);
+ return true;
+
+ case ValidationDataType.Date:
- IFormatProvider dateFormatProvider = (cultureInvariant) ?
- DateTimeFormatInfo.InvariantInfo :
- DateTimeFormatInfo.CurrentInfo;
-
- value = DateTime.Parse(text, dateFormatProvider);
- return true;
-
- case ValidationDataType.Currency:
- IFormatProvider currencyFormatProvider = (cultureInvariant) ?
- NumberFormatInfo.InvariantInfo :
- NumberFormatInfo.CurrentInfo;
- value = Decimal.Parse(text, NumberStyles.Currency, currencyFormatProvider);
- return true;
-
- default:
- value = null;
- return false;
- }
- }
- catch
- {
- value = null;
- return false;
- }
+ IFormatProvider dateFormatProvider = (cultureInvariant) ? DateTimeFormatInfo.InvariantInfo :
+ DateTimeFormatInfo.CurrentInfo;
+
+ value = DateTime.Parse(text, dateFormatProvider);
+ return true;
+
+ case ValidationDataType.Currency:
+ IFormatProvider currencyFormatProvider = (cultureInvariant) ? NumberFormatInfo.InvariantInfo :
+ NumberFormatInfo.CurrentInfo;
+ value = Decimal.Parse(text, NumberStyles.Currency, currencyFormatProvider);
+ return true;
+
+ default:
+ value = null;
+ return false;
+ }
+ } catch {
+ value = null;
+ return false;
+ }
}
}
-
}
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
static readonly object dataBoundEvent = new object ();
EventHandlerList events = new EventHandlerList ();
+ object dataSource;
+ bool initialized;
+ bool preRendered;
+ bool requiresDataBinding;
public event EventHandler DataBound {
add { events.AddHandler (dataBoundEvent, value); }
remove { events.RemoveHandler (dataBoundEvent, value); }
}
- object dataSource;
- bool initialized;
- bool preRendered;
- bool requiresDataBinding;
-
protected BaseDataBoundControl ()
{
}
[DefaultValueAttribute (null)]
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
public virtual object DataSource {
- get {
- return dataSource;
- }
+ get { return dataSource; }
set {
if(value!=null)
ValidateDataSource (value);
[DefaultValueAttribute ("")]
[ThemeableAttribute (false)]
public virtual string DataSourceID {
- get {
- return ViewState.GetString ("DataSourceID", "");
- }
+ get { return ViewState.GetString ("DataSourceID", String.Empty); }
set {
ViewState["DataSourceID"] = value;
OnDataPropertyChanged ();
}
}
-
-#endif
-
-
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
DataKeyCollection keycoll;
object source;
-#if NET_2_0
+
//string dataSourceId;
IDataSource boundDataSource = null;
bool initialized;
bool requiresDataBinding;
DataSourceSelectArguments selectArguments;
IEnumerable data;
-#endif
protected BaseDataList ()
{
[DefaultValue ("")]
-#if NET_2_0
[Localizable (true)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Accessibility")]
public virtual string Caption {
- get { return ViewState.GetString ("Caption", ""); }
+ get { return ViewState.GetString ("Caption", String.Empty); }
set {
if (value == null)
ViewState.Remove ("Caption");
}
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[DefaultValue (-1)]
[WebSysDescription("")]
[WebCategory("Layout")]
set { TableStyle.CellPadding = value; }
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[DefaultValue (0)]
[WebSysDescription("")]
[WebCategory("Layout")]
}
[DefaultValue ("")]
-#if NET_2_0
[Themeable (false)]
-#endif
[MonoTODO ("incomplete")]
[WebSysDescription("")]
[WebCategory("Data")]
public virtual string DataKeyField {
- get { return ViewState.GetString ("DataKeyField", ""); }
+ get { return ViewState.GetString ("DataKeyField", String.Empty); }
set {
if (value == null)
ViewState.Remove ("DataKeyField");
}
[DefaultValue ("")]
-#if NET_2_0
[Themeable (false)]
-#endif
[WebSysDescription("")]
[WebCategory("Data")]
public string DataMember {
- get { return ViewState.GetString ("DataMember", ""); }
+ get { return ViewState.GetString ("DataMember", String.Empty); }
set {
if (value == null)
ViewState.Remove ("DataMember");
else
ViewState ["DataMember"] = value;
-#if NET_2_0
OnDataPropertyChanged ();
-#endif
}
}
[Bindable (true)]
[DefaultValue (null)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
-#if NET_2_0
[Themeable (false)]
-#endif
[WebSysDescription("")]
[WebCategory("Data")]
- public virtual object DataSource {
+ public virtual object DataSource {
get { return source; }
set {
if ((value == null) || (value is IEnumerable) || (value is IListSource)) {
-#if NET_2_0
-// FIXME - can't duplicate in a test case ? LAMESPEC ?
-// can't duplicate in a test case
-// if ((dataSourceId != null) && (dataSourceId.Length != 0))
-// throw new HttpException (Locale.GetText ("DataSourceID is already set."));
+ // FIXME - can't duplicate in a test case ? LAMESPEC ?
+ // can't duplicate in a test case
+ // if ((dataSourceId != null) && (dataSourceId.Length != 0))
+ // throw new HttpException (Locale.GetText ("DataSourceID is already set."));
source = value;
OnDataPropertyChanged ();
-#else
- source = value;
-#endif
+
} else {
string msg = Locale.GetText ("Invalid data source. This requires an object implementing {0} or {1}.",
- "IEnumerable", "IListSource");
+ "IEnumerable", "IListSource");
throw new ArgumentException (msg);
}
}
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[DefaultValue (GridLines.Both)]
[WebSysDescription("")]
[WebCategory("Appearance")]
set { TableStyle.GridLines = value; }
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[Category ("Layout")]
[DefaultValue (HorizontalAlign.NotSet)]
[WebSysDescription("")]
get { return ViewState.GetBool ("UseAccessibleHeader", false); }
set { ViewState ["UseAccessibleHeader"] = value; }
}
-#if NET_2_0
+
[DefaultValue ("")]
[IDReferenceProperty (typeof (DataSourceControl))]
[Themeable (false)]
public virtual string DataSourceID {
- get { return ViewState.GetString ("DataSourceID", ""); }
+ get { return ViewState.GetString ("DataSourceID", String.Empty); }
set {
// LAMESPEC ? this is documented as an HttpException in beta2
if (source != null)
return selectArguments;
}
}
-#endif
+
TableStyle TableStyle {
// this will throw an InvalidCasException just like we need
get { return (TableStyle) ControlStyle; }
}
// see Kothari, page 435
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void CreateChildControls ()
+ protected internal override void CreateChildControls ()
{
// We are recreating the children from viewstate
if (HasControls ())
base.Controls.Clear();
-#if NET_2_0
if (IsDataBound)
CreateControlHierarchy (false);
else if (RequiresDataBinding)
EnsureDataBound ();
-#else
- // If presents, build the children from the viewstate
- if (ViewState ["Items"] != null)
- CreateControlHierarchy (false);
-#endif
}
protected abstract void CreateControlHierarchy (bool useDataSource);
// Indicate that child controls have been created, preventing
// CreateChildControls from getting called.
ChildControlsCreated = true;
-#if NET_2_0
RequiresDataBinding = false;
IsDataBound = true;
-#endif
}
-#if NET_2_0
+
protected virtual DataSourceSelectArguments CreateDataSourceSelectArguments ()
{
return DataSourceSelectArguments.Empty;
}
}
-#endif
-
protected override void OnDataBinding (EventArgs e)
{
base.OnDataBinding (e);
}
-#if NET_2_0
+
protected virtual void OnDataPropertyChanged ()
{
if (Initialized)
protected internal override void OnInit (EventArgs e)
{
base.OnInit (e);
- if (Page != null) {
- Page.PreLoad += new EventHandler (OnPagePreLoad);
+ Page page = Page;
+ if (page != null) {
+ page.PreLoad += new EventHandler (OnPagePreLoad);
- if (!IsViewStateEnabled && Page.IsPostBack)
+ if (!IsViewStateEnabled && page.IsPostBack)
RequiresDataBinding = true;
}
}
void Initialize ()
{
- if (Page != null) {
- if (!Page.IsPostBack || (IsViewStateEnabled && !IsDataBound))
+ Page page = Page;
+ if (page != null) {
+ if (!page.IsPostBack || (IsViewStateEnabled && !IsDataBound))
RequiresDataBinding = true;
}
EnsureDataBound ();
base.OnPreRender (e);
}
-#endif
+
protected virtual void OnSelectedIndexChanged (EventArgs e)
{
EventHandler selectedIndexChanged = (EventHandler) Events [selectedIndexChangedEvent];
protected abstract void PrepareControlHierarchy ();
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void Render (HtmlTextWriter writer)
+ protected internal override void Render (HtmlTextWriter writer)
{
PrepareControlHierarchy ();
// don't call base class or RenderBegin|EndTag
RenderContents (writer);
}
-
[WebSysDescription("")]
[WebCategory("Action")]
public event EventHandler SelectedIndexChanged {
remove { Events.RemoveHandler (selectedIndexChangedEvent, value); }
}
-
static public bool IsBindableType (Type type)
{
// I can't believe how many NRE are possible in System.Web
throw new NullReferenceException ();
switch (Type.GetTypeCode (type)) {
- case TypeCode.Boolean:
- case TypeCode.Byte:
- case TypeCode.SByte:
- case TypeCode.Int16:
- case TypeCode.UInt16:
- case TypeCode.Int32:
- case TypeCode.UInt32:
- case TypeCode.Int64:
- case TypeCode.UInt64:
- case TypeCode.Char:
- case TypeCode.Double:
- case TypeCode.Single:
- case TypeCode.DateTime:
- case TypeCode.Decimal:
- case TypeCode.String:
- return true;
- default:
- return false;
+ case TypeCode.Boolean:
+ case TypeCode.Byte:
+ case TypeCode.SByte:
+ case TypeCode.Int16:
+ case TypeCode.UInt16:
+ case TypeCode.Int32:
+ case TypeCode.UInt32:
+ case TypeCode.Int64:
+ case TypeCode.UInt64:
+ case TypeCode.Char:
+ case TypeCode.Double:
+ case TypeCode.Single:
+ case TypeCode.DateTime:
+ case TypeCode.Decimal:
+ case TypeCode.String:
+ return true;
+ default:
+ return false;
}
}
-#if NET_2_0
void ConnectToDataSource ()
{
if (NamingContainer != null)
DataSourceView dsv = boundDataSource.GetView (String.Empty);
dsv.DataSourceViewChanged += new EventHandler (OnDataSourceViewChanged);
}
-#endif
}
}
// Authors:
// Chris Toshok (toshok@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Collections;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
bool render_uplevel;
bool valid;
Color forecolor;
+ bool pre_render_called = false;
protected BaseValidator ()
{
// New in NET1.1 sp1
[Browsable(false)]
-#if ONLY_1_1
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-#endif
[EditorBrowsable(EditorBrowsableState.Never)]
public override string AssociatedControlID {
- get {
- return base.AssociatedControlID;
- }
- set {
- base.AssociatedControlID = value;
- }
+ get { return base.AssociatedControlID; }
+ set { base.AssociatedControlID = value; }
}
-#if NET_2_0
[Themeable (false)]
[DefaultValue ("")]
public virtual string ValidationGroup {
get { return base.Text; }
set { base.Text = value; }
}
-#endif
-#if NET_2_0
[IDReferenceProperty (typeof (Control))]
[Themeable (false)]
-#endif
[TypeConverter(typeof(System.Web.UI.WebControls.ValidatedControlConverter))]
[DefaultValue("")]
[WebSysDescription ("")]
set { ViewState ["ControlToValidate"] = value; }
}
-#if NET_2_0
[Themeable (false)]
-#endif
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(ValidatorDisplay.Static)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
set { ViewState ["Display"] = (int)value; }
}
-#if NET_2_0
[Themeable (false)]
-#endif
[DefaultValue(true)]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
set { ViewState ["BaseValidatorEnabled"] = value; }
}
-#if NET_2_0
[Localizable (true)]
-#endif
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue("")]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
-#if NET_2_0
- public
-#else
- public virtual
-#endif
- string ErrorMessage {
+ public string ErrorMessage {
get { return ViewState.GetString ("ErrorMessage", String.Empty); }
set { ViewState ["ErrorMessage"] = value; }
}
[Browsable(false)]
[DefaultValue(true)]
-#if NET_2_0
[Themeable (false)]
-#endif
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[WebSysDescription ("")]
[WebCategory ("Misc")]
-#if NET_2_0
- public
-#else
- public virtual
-#endif
- bool IsValid {
+ public bool IsValid {
get { return valid; }
set { valid = value; }
}
writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
if (ControlToValidate != String.Empty)
-#if NET_2_0
RegisterExpandoAttribute (ClientID, "controltovalidate", GetControlRenderID (ControlToValidate));
-#else
- writer.AddAttribute ("controltovalidate", GetControlRenderID (ControlToValidate));
-#endif
if (ErrorMessage != String.Empty)
-#if NET_2_0
RegisterExpandoAttribute (ClientID, "errormessage", ErrorMessage, true);
-#else
- writer.AddAttribute ("errormessage", ErrorMessage);
- if (Text != String.Empty)
- writer.AddAttribute ("text", Text);
-#endif
-
-#if NET_2_0
if (ValidationGroup != String.Empty)
RegisterExpandoAttribute (ClientID, "validationGroup", ValidationGroup, true);
if (SetFocusOnError)
RegisterExpandoAttribute (ClientID, "focusOnError", "t");
-#endif
- if (!IsEnabled)
-#if NET_2_0
+
+ bool enabled = IsEnabled;
+ if (!enabled)
RegisterExpandoAttribute (ClientID, "enabled", "False");
-#else
- writer.AddAttribute ("enabled", "false", false);
-#endif
-#if NET_2_0
- if (IsEnabled && !IsValid) {
+ if (enabled && !IsValid)
RegisterExpandoAttribute (ClientID, "isvalid", "False");
-#else
- if (!IsValid) {
- writer.AddAttribute ("isvalid", "false", false);
-#endif
- }
else {
if (Display == ValidatorDisplay.Static)
writer.AddStyleAttribute ("visibility", "hidden");
}
if (Display != ValidatorDisplay.Static)
-#if NET_2_0
RegisterExpandoAttribute (ClientID, "display", Display.ToString ());
-#else
- writer.AddAttribute ("display", Display.ToString());
-#endif
}
base.AddAttributesToRender (writer);
}
-#if NET_2_0
- internal void RegisterExpandoAttribute (string controlId, string attributeName, string attributeValue) {
+ internal void RegisterExpandoAttribute (string controlId, string attributeName, string attributeValue)
+ {
RegisterExpandoAttribute (controlId, attributeName, attributeValue, false);
}
- internal void RegisterExpandoAttribute (string controlId, string attributeName, string attributeValue, bool encode) {
- if (Page.ScriptManager != null)
- Page.ScriptManager.RegisterExpandoAttributeExternal (this, controlId, attributeName, attributeValue, encode);
+ internal void RegisterExpandoAttribute (string controlId, string attributeName, string attributeValue, bool encode)
+ {
+ Page page = Page;
+ if (page.ScriptManager != null)
+ page.ScriptManager.RegisterExpandoAttributeExternal (this, controlId, attributeName, attributeValue, encode);
else
- Page.ClientScript.RegisterExpandoAttribute (controlId, attributeName, attributeValue, encode);
+ page.ClientScript.RegisterExpandoAttribute (controlId, attributeName, attributeValue, encode);
}
-#endif
protected void CheckControlValidationProperty (string name, string propertyName)
{
throw new HttpException (String.Format ("ControlToValidate property of '{0}' cannot be blank.", ID));
}
- CheckControlValidationProperty (ControlToValidate, "");
+ CheckControlValidationProperty (ControlToValidate, String.Empty);
return true;
}
return null;
}
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void OnInit (EventArgs e)
+ protected internal override void OnInit (EventArgs e)
{
+ Page page = Page;
/* according to an msdn article, this is done here */
- if (Page != null) {
- Page.Validators.Add (this);
-
-#if NET_2_0
- Page.GetValidators (ValidationGroup).Add (this);
-#endif
+ if (page != null) {
+ page.Validators.Add (this);
+ page.GetValidators (ValidationGroup).Add (this);
}
base.OnInit (e);
}
- bool pre_render_called = false;
-
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void OnPreRender (EventArgs e)
+ protected internal override void OnPreRender (EventArgs e)
{
base.OnPreRender (e);
ControlPropertiesValid ();
render_uplevel = DetermineRenderUplevel ();
- if (render_uplevel) {
+ if (render_uplevel)
RegisterValidatorCommonScript ();
- }
}
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void OnUnload (EventArgs e)
+ protected internal override void OnUnload (EventArgs e)
{
+ Page page = Page;
/* according to an msdn article, this is done here */
- if (Page != null) {
- Page.Validators.Remove (this);
-
-#if NET_2_0
- if (ValidationGroup != "")
- Page.GetValidators (ValidationGroup).Remove (this);
-#endif
-
+ if (page != null) {
+ page.Validators.Remove (this);
+ string validationGroup = ValidationGroup;
+ if (!String.IsNullOrEmpty (validationGroup))
+ page.GetValidators (ValidationGroup).Remove (this);
}
base.OnUnload (e);
}
protected void RegisterValidatorCommonScript ()
{
-#if NET_2_0
- if (Page.ScriptManager != null) {
- Page.ScriptManager.RegisterClientScriptResourceExternal (this, typeof (BaseValidator), "WebUIValidation_2.0.js");
- Page.ScriptManager.RegisterClientScriptBlockExternal (this, typeof (BaseValidator), "ValidationInitializeScript", Page.ValidationInitializeScript, true);
- Page.ScriptManager.RegisterOnSubmitStatementExternal (this, typeof (BaseValidator), "ValidationOnSubmitStatement", Page.ValidationOnSubmitStatement);
- Page.ScriptManager.RegisterStartupScriptExternal (this, typeof (BaseValidator), "ValidationStartupScript", Page.ValidationStartupScript, true);
- }
- else
-#endif
- if (!Page.ClientScript.IsClientScriptIncludeRegistered (typeof (BaseValidator), "Mono-System.Web-ValidationClientScriptBlock"))
- {
- Page.ClientScript.RegisterClientScriptInclude (typeof (BaseValidator), "Mono-System.Web-ValidationClientScriptBlock",
- Page.ClientScript.GetWebResourceUrl (typeof (BaseValidator),
-#if NET_2_0
- "WebUIValidation_2.0.js"));
- Page.ClientScript.RegisterClientScriptBlock (typeof (BaseValidator), "Mono-System.Web-ValidationClientScriptBlock.Initialize", Page.ValidationInitializeScript, true);
- Page.ClientScript.RegisterOnSubmitStatement (typeof (BaseValidator), "Mono-System.Web-ValidationOnSubmitStatement", Page.ValidationOnSubmitStatement);
- Page.ClientScript.RegisterStartupScript (typeof (BaseValidator), "Mono-System.Web-ValidationStartupScript", Page.ValidationStartupScript, true);
-#else
- "WebUIValidation.js"));
-
- Page.ClientScript.RegisterOnSubmitStatement ("Mono-System.Web-ValidationOnSubmitStatement",
- "if (!ValidatorOnSubmit()) return false;");
- Page.ClientScript.RegisterStartupScript ("Mono-System.Web-ValidationStartupScript",
- "<script language=\"JavaScript\">\n" +
- "<!--\n" +
- "var Page_ValidationActive = false;\n" +
- "ValidatorOnLoad();\n" +
- "\n" +
- "function ValidatorOnSubmit() {\n" +
- " if (Page_ValidationActive) {\n" +
- " if (!ValidatorCommonOnSubmit())\n" +
- " return Page_ClientValidate ();\n" +
- " }\n" +
- " return true;\n" +
- "}\n" +
- "// -->\n" +
- "</script>\n");
-#endif
+ Page page = Page;
+ if (page != null) {
+ if (page.ScriptManager != null) {
+ page.ScriptManager.RegisterClientScriptResourceExternal (this, typeof (BaseValidator), "WebUIValidation_2.0.js");
+ page.ScriptManager.RegisterClientScriptBlockExternal (this, typeof (BaseValidator), "ValidationInitializeScript", page.ValidationInitializeScript, true);
+ page.ScriptManager.RegisterOnSubmitStatementExternal (this, typeof (BaseValidator), "ValidationOnSubmitStatement", page.ValidationOnSubmitStatement);
+ page.ScriptManager.RegisterStartupScriptExternal (this, typeof (BaseValidator), "ValidationStartupScript", page.ValidationStartupScript, true);
+ } else if (!page.ClientScript.IsClientScriptIncludeRegistered (typeof (BaseValidator), "Mono-System.Web-ValidationClientScriptBlock")) {
+ page.ClientScript.RegisterClientScriptInclude (typeof (BaseValidator), "Mono-System.Web-ValidationClientScriptBlock",
+ page.ClientScript.GetWebResourceUrl (typeof (BaseValidator), "WebUIValidation_2.0.js"));
+ page.ClientScript.RegisterClientScriptBlock (typeof (BaseValidator), "Mono-System.Web-ValidationClientScriptBlock.Initialize", page.ValidationInitializeScript, true);
+ page.ClientScript.RegisterOnSubmitStatement (typeof (BaseValidator), "Mono-System.Web-ValidationOnSubmitStatement", page.ValidationOnSubmitStatement);
+ page.ClientScript.RegisterStartupScript (typeof (BaseValidator), "Mono-System.Web-ValidationStartupScript", page.ValidationStartupScript, true);
+ }
}
}
protected virtual void RegisterValidatorDeclaration ()
{
-#if NET_2_0
- if (Page.ScriptManager != null) {
- Page.ScriptManager.RegisterArrayDeclarationExternal (this, "Page_Validators", String.Concat ("document.getElementById ('", ClientID, "')"));
- Page.ScriptManager.RegisterStartupScriptExternal (this, typeof (BaseValidator), ClientID + "DisposeScript",
-@"
+ Page page = Page;
+ if (page != null) {
+ if (page.ScriptManager != null) {
+ page.ScriptManager.RegisterArrayDeclarationExternal (this, "Page_Validators", String.Concat ("document.getElementById ('", ClientID, "')"));
+ page.ScriptManager.RegisterStartupScriptExternal (this, typeof (BaseValidator), ClientID + "DisposeScript",
+ @"
document.getElementById('" + ClientID + @"').dispose = function() {
Array.remove(Page_Validators, document.getElementById('" + ClientID + @"'));
}
", true);
+ } else
+ page.ClientScript.RegisterArrayDeclaration ("Page_Validators", String.Concat ("document.getElementById ('", ClientID, "')"));
}
- else
-#endif
- Page.ClientScript.RegisterArrayDeclaration ("Page_Validators",
- String.Concat ("document.getElementById ('", ClientID, "')"));
}
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void Render (HtmlTextWriter writer)
+ protected internal override void Render (HtmlTextWriter writer)
{
-#if NET_2_0
if (!IsEnabled && !EnableClientScript)
return;
-#endif
+
if (render_uplevel) {
/* according to an msdn article, this is done here */
RegisterValidatorDeclaration ();
if (!pre_render_called) {
render_tags = true;
render_text = true;
- }
- else if (render_uplevel) {
+ } else if (render_uplevel) {
render_tags = true;
-#if NET_2_0
render_text = Display != ValidatorDisplay.None;
-#else
- if (Display != ValidatorDisplay.None)
- render_text = !v || Display == ValidatorDisplay.Dynamic;
-#endif
- }
- else {
+ } else {
if (Display != ValidatorDisplay.None) {
render_tags = !v;
render_text = !v;
string text;
if (render_text) {
text = Text;
- if (text == "")
+ if (String.IsNullOrEmpty (text))
text = ErrorMessage;
- } else {
+ } else
text = " ";
- }
writer.Write (text);
}
- if (render_tags) {
+ if (render_tags)
writer.RenderEndTag ();
- }
}
/* the docs say "public sealed" here */
-#if NET_2_0
- public
-#else
- public virtual
-#endif
- void Validate ()
+ public void Validate ()
{
if (IsEnabled && Visible)
IsValid = ControlPropertiesValid () && EvaluateIsValid ();
IsValid = true;
}
}
-
}
// Author:
// Dick Porter <dick@ximian.com>
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-namespace System.Web.UI.WebControls {
-#if !NET_2_0
- [Serializable]
-#endif
- public enum BorderStyle {
+namespace System.Web.UI.WebControls
+{
+ public enum BorderStyle
+ {
NotSet,
None,
Dotted,
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Web.UI;
using System.Security.Permissions;
using System.Reflection;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class BoundField : DataControlField
[WebSysDescription ("")]
[WebCategoryAttribute ("Behavior")]
public virtual bool ApplyFormatInEditMode {
- get {
- return ViewState.GetBool ("ApplyFormatInEditMode", false);
- }
- set {
- ViewState ["ApplyFormatInEditMode"] = value;
- }
+ get { return ViewState.GetBool ("ApplyFormatInEditMode", false); }
+ set { ViewState ["ApplyFormatInEditMode"] = value; }
}
[DefaultValueAttribute (true)]
[WebCategoryAttribute ("Data")]
[DefaultValueAttribute ("")]
public virtual string DataField {
- get { return ViewState.GetString ("DataField", ""); }
+ get { return ViewState.GetString ("DataField", String.Empty); }
set {
ViewState ["DataField"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Data")]
public virtual string DataFormatString {
- get { return ViewState.GetString ("DataFormatString", ""); }
+ get { return ViewState.GetString ("DataFormatString", String.Empty); }
set {
ViewState ["DataFormatString"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public override string HeaderText {
- get { return ViewState.GetString ("HeaderText", "");
- }
+ get { return ViewState.GetString ("HeaderText", String.Empty); }
set {
ViewState["HeaderText"] = value;
OnFieldChanged ();
[DefaultValueAttribute ("")]
[WebCategoryAttribute ("Behavior")]
public virtual string NullDisplayText {
- get { return ViewState.GetString ("NullDisplayText", ""); }
+ get { return ViewState.GetString ("NullDisplayText", String.Empty); }
set {
ViewState ["NullDisplayText"] = value;
OnFieldChanged ();
TextBox box = (TextBox) cell.Controls [0];
dictionary [DataField] = box.Text;
}
- } else if (includeReadOnly) {
+ } else if (includeReadOnly)
dictionary [DataField] = cell.Text;
- }
}
- public override bool Initialize (bool enableSorting,
- Control control)
+ public override bool Initialize (bool enableSorting, Control control)
{
return base.Initialize (enableSorting, control);
}
if (NullDisplayText.Length == 0) {
encode = false;
res = " ";
- }
- else
+ } else
res = NullDisplayText;
- }
- else if (DataFormatString.Length > 0)
+ } else if (DataFormatString.Length > 0)
res = string.Format (DataFormatString, value);
else
res = stringValue;
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-namespace System.Web.UI.WebControls {
- public enum BulletStyle {
+namespace System.Web.UI.WebControls
+{
+ public enum BulletStyle
+ {
NotSet,
Numbered,
LowerAlpha,
CustomImage,
}
}
-#endif
\ No newline at end of file
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+
using System.IO;
using System.Collections;
using System.Globalization;
using System.Security.Permissions;
using System.Web.Util;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[DefaultEventAttribute ("Click")]
[DefaultPropertyAttribute ("BulletStyle")]
[SupportsEventValidation]
- public class BulletedList : ListControl, IPostBackEventHandler {
-
+ public class BulletedList : ListControl, IPostBackEventHandler
+ {
+ static readonly object ClickEvent = new object ();
PostBackOptions postBackOptions;
-
+
+ public event BulletedListEventHandler Click {
+ add { Events.AddHandler (ClickEvent, value); }
+ remove { Events.RemoveHandler (ClickEvent, value); }
+ }
+
[MonoTODO ("we are missing a new style enum, we should be using it")]
protected override void AddAttributesToRender (HtmlTextWriter writer)
{
const string ListStyleImage = "list-style-image";
bool isNumeric = false;
- switch (BulletStyle)
- {
+ switch (BulletStyle) {
case BulletStyle.NotSet:
break;
if (Target.Length > 0)
writer.AddAttribute(HtmlTextWriterAttribute.Target, this.Target);
- }
- else
+ } else
writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
writer.RenderBeginTag (HtmlTextWriterTag.A);
}
}
- PostBackOptions GetPostBackOptions (string argument) {
+ PostBackOptions GetPostBackOptions (string argument)
+ {
if (postBackOptions == null) {
postBackOptions = new PostBackOptions (this);
postBackOptions.ActionUrl = null;
protected internal override void RenderContents (HtmlTextWriter writer)
{
int idx = 0;
-#if NET_2_0
- bool havePage = Page != null;
-#endif
+ Page page = Page;
+ ClientScriptManager scriptManager = page != null ? page.ClientScript : null;
+
foreach (ListItem i in Items) {
-#if NET_2_0
- if (havePage)
- Page.ClientScript.RegisterForEventValidation (UniqueID, i.Value);
+ if (page != null)
+ scriptManager.RegisterForEventValidation (UniqueID, i.Value);
if (i.HasAttributes)
i.Attributes.AddAttributes (writer);
-#endif
+
writer.RenderBeginTag (HtmlTextWriterTag.Li);
this.RenderBulletText (i, idx ++, writer);
writer.RenderEndTag ();
this.OnClick (new BulletedListEventArgs (int.Parse (eventArgument, Helpers.InvariantCulture)));
}
- [BrowsableAttribute (false)]
- [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [BrowsableAttribute (false)]
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
public override bool AutoPostBack {
get { return base.AutoPostBack; }
set { throw new NotSupportedException (String.Format ("This property is not supported in {0}", GetType ())); }
set { throw new NotSupportedException (String.Format ("This property is not supported in {0}", GetType ())); }
}
- [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
public override ListItem SelectedItem {
get { return null; }
}
[EditorBrowsable (EditorBrowsableState.Never)]
[Bindable (false)]
- public override string SelectedValue
- {
+ public override string SelectedValue {
get { return string.Empty; }
set { throw new NotSupportedException (); }
}
[EditorAttribute ("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
[UrlPropertyAttribute]
public virtual string BulletImageUrl {
- get { return ViewState.GetString ("BulletImageUrl", ""); }
+ get { return ViewState.GetString ("BulletImageUrl", String.Empty); }
set { ViewState ["BulletImageUrl"] = value; }
}
- [DefaultValueAttribute (BulletStyle.NotSet)]
+ [DefaultValueAttribute (BulletStyle.NotSet)]
public virtual BulletStyle BulletStyle {
get { return (BulletStyle) ViewState.GetInt ("BulletStyle", (int) BulletStyle.NotSet); }
set {
public override ControlCollection Controls { get { return new EmptyControlCollection (this); } }
- [DefaultValueAttribute (BulletedListDisplayMode.Text)]
+ [DefaultValueAttribute (BulletedListDisplayMode.Text)]
public virtual BulletedListDisplayMode DisplayMode {
get { return (BulletedListDisplayMode) ViewState.GetInt ("DisplayMode", (int)BulletedListDisplayMode.Text); }
set {
}
}
- [DefaultValueAttribute (1)]
+ [DefaultValueAttribute (1)]
public virtual int FirstBulletNumber {
get { return ViewState.GetInt ("FirstBulletNumber", 1); }
set { ViewState ["FirstBulletNumber"] = value; }
}
-
protected override HtmlTextWriterTag TagKey {
get {
}
[EditorBrowsable (EditorBrowsableState.Never)]
- public override string Text
- {
- get { return string.Empty; }
+ public override string Text {
+ get { return String.Empty; }
set { throw new NotSupportedException (); }
}
-
- static readonly object ClickEvent = new object ();
- public event BulletedListEventHandler Click
- {
- add {
- Events.AddHandler (ClickEvent, value);
- }
- remove {
- Events.RemoveHandler (ClickEvent, value);
- }
- }
-
protected virtual void OnClick (BulletedListEventArgs e)
{
if (Events != null) {
}
}
}
-#endif
+
// Authors:
// Jordi Mas i Hernandez (jordi@ximian.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.ComponentModel.Design;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[DataBindingHandler ("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
[DefaultProperty ("Text")]
[Designer ("System.Web.UI.Design.WebControls.ButtonDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
-
-#if NET_2_0
[ToolboxDataAttribute ("<{0}:Button runat=\"server\" Text=\"Button\"></{0}:Button>")]
[SupportsEventValidation]
-#else
- [ToolboxDataAttribute ("<{0}:Button runat=server Text=\"Button\"></{0}:Button>")]
-#endif
-
- public class Button : WebControl, IPostBackEventHandler
-#if NET_2_0
- , IButtonControl
-#endif
+ public class Button : WebControl, IPostBackEventHandler, IButtonControl
{
static readonly object ClickEvent = new object ();
static readonly object CommandEvent = new object ();
{
}
-#if ONLY_1_1
- [Bindable (false)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Behavior")]
[DefaultValue (true)]
-#if NET_2_0
[Themeable (false)]
- public virtual
-#else
- public
-#endif
- bool CausesValidation {
- get {
- return ViewState.GetBool ("CausesValidation", true);
- }
-
- set {
- ViewState ["CausesValidation"] = value;
- }
+ public virtual bool CausesValidation {
+ get { return ViewState.GetBool ("CausesValidation", true); }
+ set { ViewState ["CausesValidation"] = value; }
}
[DefaultValue ("")]
[Bindable (true)]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
-#if NET_2_0
[Themeable (false)]
-#endif
public string CommandArgument {
- get {
- return ViewState.GetString ("CommandArgument", "");
- }
- set {
- ViewState ["CommandArgument"] = value;
- }
+ get { return ViewState.GetString ("CommandArgument", String.Empty); }
+ set { ViewState ["CommandArgument"] = value; }
}
[DefaultValue ("")]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
-#if NET_2_0
[Themeable (false)]
-#endif
public string CommandName {
- get {
- return ViewState.GetString ("CommandName", "");
- }
- set {
- ViewState ["CommandName"] = value;
- }
+ get { return ViewState.GetString ("CommandName", String.Empty); }
+ set { ViewState ["CommandName"] = value; }
}
-#if NET_2_0
[Themeable (false)]
[DefaultValue ("")]
[WebSysDescription ("")]
[WebCategoryAttribute ("Behavior")]
- public virtual string OnClientClick
- {
- get {
- return ViewState.GetString ("OnClientClick", "");
- }
- set {
- ViewState ["OnClientClick"] = value;
- }
+ public virtual string OnClientClick {
+ get { return ViewState.GetString ("OnClientClick", String.Empty); }
+ set { ViewState ["OnClientClick"] = value; }
}
-#endif
-
[DefaultValue ("")]
[Bindable (true)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
-#if NET_2_0
[Localizable (true)]
-#endif
public string Text {
- get {
- return ViewState.GetString ("Text", "");
- }
- set {
- ViewState ["Text"] = value;
- }
+ get { return ViewState.GetString ("Text", String.Empty); }
+ set { ViewState ["Text"] = value; }
}
-#if NET_2_0
[DefaultValue (true)]
[Themeable (false)]
[WebSysDescription ("")]
[WebCategoryAttribute ("Behavior")]
- public virtual bool UseSubmitBehavior
- {
- get {
- return ViewState.GetBool ("UseSubmitBehavior", true);
- }
- set {
- ViewState ["UseSubmitBehavior"] = value;
- }
+ public virtual bool UseSubmitBehavior {
+ get { return ViewState.GetBool ("UseSubmitBehavior", true); }
+ set { ViewState ["UseSubmitBehavior"] = value; }
}
-#endif
- protected override void AddAttributesToRender (HtmlTextWriter writer) {
- if (Page != null)
- Page.VerifyRenderingInServerForm (this);
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
+ Page page = Page;
+ if (page != null)
+ page.VerifyRenderingInServerForm (this);
-#if NET_2_0
writer.AddAttribute (HtmlTextWriterAttribute.Type, UseSubmitBehavior ? "submit" : "button", false);
writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
Attributes.Remove ("onclick");
}
- if (Page != null) {
+ if (page != null)
onclick += GetClientScriptEventReference ();
- }
if (onclick.Length > 0)
writer.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick);
-#else
- writer.AddAttribute (HtmlTextWriterAttribute.Type, "submit");
- writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
- writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
-
- if (CausesValidation && Page != null && Page.AreValidatorsUplevel ()) {
- string onclick = Attributes["onclick"];
- if (onclick != null) {
- Attributes.Remove("onclick");
- int len = onclick.Length;
- if (len > 0 && onclick[len - 1] != ';')
- onclick += ";";
- }
- ClientScriptManager csm = new ClientScriptManager (Page);
- writer.AddAttribute (HtmlTextWriterAttribute.Onclick, onclick + csm.GetClientValidationEvent ());
- writer.AddAttribute ("language", "javascript");
- }
-#endif
base.AddAttributesToRender (writer);
}
-#if NET_2_0
internal virtual string GetClientScriptEventReference ()
{
PostBackOptions options = GetPostBackOptions ();
- return Page.ClientScript.GetPostBackEventReference (options, true);
+ Page page = Page;
+ if (page != null)
+ return page.ClientScript.GetPostBackEventReference (options, true);
+ else
+ return String.Empty;
}
protected virtual PostBackOptions GetPostBackOptions ()
options.Argument = String.Empty;
options.RequiresJavaScriptProtocol = false;
options.ClientSubmit = !UseSubmitBehavior;
- options.PerformValidation = CausesValidation && Page != null && Page.AreValidatorsUplevel (ValidationGroup);
+
+ Page page = Page;
+ options.PerformValidation = CausesValidation && page != null && page.AreValidatorsUplevel (ValidationGroup);
if (options.PerformValidation)
options.ValidationGroup = ValidationGroup;
return options;
}
-#endif
void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
{
RaiseBubbleEvent (this, e);
}
-#if NET_2_0
- protected virtual
-#endif
- void RaisePostBackEvent (string eventArgument)
+ protected virtual void RaisePostBackEvent (string eventArgument)
{
-#if NET_2_0
ValidateEvent (UniqueID, eventArgument);
-#endif
- if (CausesValidation)
-#if NET_2_0
- Page.Validate (ValidationGroup);
-#else
- Page.Validate ();
-#endif
-
+ if (CausesValidation) {
+ Page page = Page;
+ if (page != null)
+ page.Validate (ValidationGroup);
+ }
+
OnClick (EventArgs.Empty);
OnCommand (new CommandEventArgs (CommandName, CommandArgument));
}
-#if NET_2_0
protected internal override void OnPreRender (EventArgs e)
{
// Why override?
base.OnPreRender (e);
}
-#endif
-
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void RenderContents (HtmlTextWriter writer)
+
+ protected internal override void RenderContents (HtmlTextWriter writer)
{
}
[WebSysDescription ("")]
[WebCategory ("Action")]
- public event EventHandler Click
- {
- add {
- Events.AddHandler (ClickEvent, value);
- }
- remove {
- Events.RemoveHandler (ClickEvent, value);
- }
+ public event EventHandler Click {
+ add { Events.AddHandler (ClickEvent, value); }
+ remove { Events.RemoveHandler (ClickEvent, value); }
}
[WebSysDescription ("")]
[WebCategory ("Action")]
- public event CommandEventHandler Command
- {
- add {
- Events.AddHandler (CommandEvent, value);
- }
- remove {
- Events.RemoveHandler (CommandEvent, value);
- }
+ public event CommandEventHandler Command {
+ add { Events.AddHandler (CommandEvent, value); }
+ remove { Events.RemoveHandler (CommandEvent, value); }
}
-#if NET_2_0
[DefaultValue ("")]
[Editor ("System.Web.UI.Design.UrlEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
[Themeable (false)]
[UrlProperty("*.aspx")]
public virtual string PostBackUrl {
- get {
- return ViewState.GetString ("PostBackUrl", "");
- }
- set {
- ViewState ["PostBackUrl"] = value;
- }
+ get { return ViewState.GetString ("PostBackUrl", String.Empty); }
+ set { ViewState ["PostBackUrl"] = value; }
}
[DefaultValue ("")]
[WebSysDescription ("")]
[WebCategoryAttribute ("Behavior")]
public virtual string ValidationGroup {
- get {
- return ViewState.GetString ("ValidationGroup", "");
- }
- set {
- ViewState ["ValidationGroup"] = value;
- }
- }
-#endif
-
+ get { return ViewState.GetString ("ValidationGroup", String.Empty); }
+ set { ViewState ["ValidationGroup"] = value; }
+ }
}
}
-
-
// Dick Porter <dick@ximian.com>
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public class ButtonColumn : DataGridColumn {
-
+ public class ButtonColumn : DataGridColumn
+ {
+ string text_field;
+ string format;
+
[DefaultValue(ButtonColumnType.LinkButton)]
-#if NET_2_0
[WebSysDescription("The type of button contained within the column.")]
-#else
- [Description("The type of button contained within the column.")]
-#endif
[WebCategory ("Misc")]
- public virtual ButtonColumnType ButtonType
- {
+ public virtual ButtonColumnType ButtonType {
get {
return (ButtonColumnType) ViewState.GetInt ("LinkButton",
(int) ButtonColumnType.LinkButton);
}
- set {
- ViewState ["LinkButton"] = value;
- }
+ set { ViewState ["LinkButton"] = value; }
}
[DefaultValue("")]
-#if NET_2_0
[WebSysDescription("The command associated with the button.")]
-#else
- [Description("The command associated with the button.")]
-#endif
[WebCategory ("Misc")]
- public virtual string CommandName
- {
- get {
- return ViewState.GetString ("CommandName", String.Empty);
- }
- set {
- ViewState ["CommandName"] = value;
- }
+ public virtual string CommandName {
+ get { return ViewState.GetString ("CommandName", String.Empty); }
+ set { ViewState ["CommandName"] = value; }
}
-#if NET_2_0
[DefaultValue (false)]
[WebSysDescription("")]
[WebCategory ("Behavior")]
- public virtual bool CausesValidation
- {
- get {
- return ViewState.GetBool ("CausesValidation", false);
- }
- set {
- ViewState ["CausesValidation"] = value;
- }
+ public virtual bool CausesValidation {
+ get { return ViewState.GetBool ("CausesValidation", false); }
+ set { ViewState ["CausesValidation"] = value; }
}
-#endif
[DefaultValue("")]
-#if NET_2_0
[WebSysDescription("The field bound to the text property of the button.")]
-#else
- [Description("The field bound to the text property of the button.")]
-#endif
[WebCategory ("Misc")]
- public virtual string DataTextField
- {
- get {
- return ViewState.GetString ("DataTextField", String.Empty);
- }
- set {
- ViewState ["DataTextField"] = value;
- }
+ public virtual string DataTextField {
+ get { return ViewState.GetString ("DataTextField", String.Empty); }
+ set { ViewState ["DataTextField"] = value; }
}
[DefaultValue("")]
-#if NET_2_0
[WebSysDescription("The formatting applied to the value bound to the Text property.")]
-#else
- [Description("The formatting applied to the value bound to the Text property.")]
-#endif
[WebCategory ("Misc")]
- public virtual string DataTextFormatString
- {
- get {
- return ViewState.GetString ("DataTextFormatString",
- String.Empty);
- }
+ public virtual string DataTextFormatString {
+ get { return ViewState.GetString ("DataTextFormatString", String.Empty); }
set {
ViewState ["DataTextFormatString"] = value;
format = null;
}
[DefaultValue("")]
-#if NET_2_0
[Localizable (true)]
[WebSysDescription("The text used for the button.")]
-#else
- [Description("The text used for the button.")]
-#endif
[WebCategory ("Misc")]
- public virtual string Text
- {
- get {
- return ViewState.GetString ("Text", String.Empty);
- }
- set {
- ViewState ["Text"] = value;
- }
+ public virtual string Text {
+ get { return ViewState.GetString ("Text", String.Empty); }
+ set { ViewState ["Text"] = value; }
}
-#if NET_2_0
[DefaultValue ("")]
[WebSysDescription("")]
[WebCategory ("Behavior")]
- public virtual string ValidationGroup
- {
- get {
- return ViewState.GetString ("ValidationGroup", "");
- }
- set {
- ViewState ["ValidationGroup"] = value;
- }
+ public virtual string ValidationGroup {
+ get { return ViewState.GetString ("ValidationGroup", String.Empty); }
+ set { ViewState ["ValidationGroup"] = value; }
}
-#endif
public override void Initialize ()
{
base.Initialize ();
}
- public override void InitializeCell (TableCell cell,
- int columnIndex,
- ListItemType itemType)
+ public override void InitializeCell (TableCell cell, int columnIndex, ListItemType itemType)
{
base.InitializeCell (cell, columnIndex, itemType);
- if (itemType != ListItemType.Header &&
- itemType != ListItemType.Footer) {
+ if (itemType != ListItemType.Header && itemType != ListItemType.Footer) {
switch (ButtonType) {
- case ButtonColumnType.LinkButton:
- {
- LinkButton butt = new ForeColorLinkButton ();
+ case ButtonColumnType.LinkButton:
+ {
+ LinkButton butt = new ForeColorLinkButton ();
- butt.Text = Text;
- butt.CommandName = CommandName;
+ butt.Text = Text;
+ butt.CommandName = CommandName;
- if (DataTextField != "")
- butt.DataBinding += new EventHandler (DoDataBind);
+ if (!String.IsNullOrEmpty (DataTextField))
+ butt.DataBinding += new EventHandler (DoDataBind);
- cell.Controls.Add (butt);
- }
- break;
+ cell.Controls.Add (butt);
+ }
+ break;
- case ButtonColumnType.PushButton:
- {
- Button butt = new Button ();
+ case ButtonColumnType.PushButton:
+ {
+ Button butt = new Button ();
- butt.Text = Text;
- butt.CommandName = CommandName;
-
- if (DataTextField != "")
- butt.DataBinding += new EventHandler (DoDataBind);
- cell.Controls.Add (butt);
- }
- break;
+ butt.Text = Text;
+ butt.CommandName = CommandName;
+
+ if (!String.IsNullOrEmpty (DataTextField))
+ butt.DataBinding += new EventHandler (DoDataBind);
+ cell.Controls.Add (butt);
+ }
+ break;
}
}
}
-
- string text_field;
+
string GetValueFromItem (DataGridItem item)
{
object val = null;
if (text_field == null)
text_field = DataTextField;
- if (text_field != "")
+ if (!String.IsNullOrEmpty (text_field))
val = DataBinder.Eval (item.DataItem, text_field);
return FormatDataTextValue (val);
if (lb == null) {
Button b = (Button) sender;
b.Text = text;
- } else {
+ } else
lb.Text = text;
- }
}
-
- string format;
+
protected virtual string FormatDataTextValue (object dataTextValue)
{
if (dataTextValue == null)
- return "";
+ return String.Empty;
if (format == null)
format = DataTextFormatString;
- if (format == "")
+ if (String.IsNullOrEmpty (format))
return dataTextValue.ToString ();
return String.Format (format, dataTextValue);
//
// Author: Duncan Mak (duncan@novell.com)
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System;
-namespace System.Web.UI.WebControls {
-
-#if !NET_2_0
- [Serializable]
-#endif
+namespace System.Web.UI.WebControls
+{
public enum ButtonColumnType
{
LinkButton,
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Reflection;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class ButtonField : ButtonFieldBase
[WebSysDescription ("Raised when a Button Command is executed.")]
[WebCategoryAttribute ("Behavior")]
public virtual string CommandName {
- get { return ViewState.GetString ("CommandName", ""); }
+ get { return ViewState.GetString ("CommandName", String.Empty); }
set {
ViewState ["CommandName"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Data")]
public virtual string DataTextField {
- get { return ViewState.GetString ("DataTextField", ""); }
+ get { return ViewState.GetString ("DataTextField", String.Empty); }
set {
ViewState ["DataTextField"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Data")]
public virtual string DataTextFormatString {
- get { return ViewState.GetString ("DataTextFormatString", ""); }
+ get { return ViewState.GetString ("DataTextFormatString", String.Empty); }
set {
ViewState ["DataTextFormatString"] = value;
OnFieldChanged ();
[DefaultValueAttribute ("")]
[UrlPropertyAttribute]
public virtual string ImageUrl {
- get { return ViewState.GetString ("ImageUrl", ""); }
+ get { return ViewState.GetString ("ImageUrl", String.Empty); }
set {
ViewState ["ImageUrl"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public virtual string Text {
- get { return ViewState.GetString ("Text", ""); }
+ get { return ViewState.GetString ("Text", String.Empty); }
set {
ViewState ["Text"] = value;
OnFieldChanged ();
protected virtual string FormatDataTextValue (object value)
{
if (DataTextFormatString.Length > 0)
- return string.Format (DataTextFormatString, value);
+ return String.Format (DataTextFormatString, value);
else if (value == null)
- return string.Empty;
+ return String.Empty;
else
return value.ToString ();
}
btn.ValidationGroup = ValidationGroup;
}
- if (DataTextField != "") {
+ if (!String.IsNullOrEmpty (DataTextField)) {
if ((rowState & DataControlRowState.Insert) == 0)
cell.DataBinding += new EventHandler (OnDataBindField);
}
cell.Controls.Add ((Control) btn);
- }
- else
+ } else
base.InitializeCell (cell, cellType, rowState, rowIndex);
}
}
}
}
-#endif
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Web.UI;
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public abstract class ButtonFieldBase : DataControlField
[WebSysDescription ("")]
[WebCategoryAttribute ("Behavior")]
public virtual string ValidationGroup {
- get { return ViewState.GetString ("ValidationGroup", ""); }
+ get { return ViewState.GetString ("ValidationGroup", String.Empty); }
set {
ViewState ["ValidationGroup"] = value;
OnFieldChanged ();
}
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
namespace System.Web.UI.WebControls
{
public enum ButtonType
Link = 2,
}
}
-#endif
+
// Authors:
// Jordi Mas i Hernandez (jordi@ximian.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
//
using System.Text;
using System.Web.Util;
-namespace System.Web.UI.WebControls {
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[DefaultEvent("SelectionChanged")]
[DefaultProperty("SelectedDate")]
[Designer("System.Web.UI.Design.WebControls.CalendarDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
-#if NET_2_0
[ControlValueProperty ("SelectedDate", "1/1/0001 12:00:00 AM")]
[SupportsEventValidation]
-#endif
public class Calendar : WebControl, IPostBackEventHandler
{
TableItemStyle dayHeaderStyle;
{
}
-#if NET_2_0
[Localizable (true)]
[DefaultValue ("")]
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
- public virtual string Caption
- {
- get {
- return ViewState.GetString ("Caption", "");
- }
- set {
- ViewState["Caption"] = value;
- }
+ public virtual string Caption {
+ get { return ViewState.GetString ("Caption", String.Empty); }
+ set { ViewState["Caption"] = value; }
}
[DefaultValue (TableCaptionAlign.NotSet)]
[WebSysDescription ("")]
[WebCategoryAttribute ("Accessibility")]
- public virtual TableCaptionAlign CaptionAlign
- {
- get {
- return (TableCaptionAlign)ViewState.GetInt ("CaptionAlign", (int)TableCaptionAlign.NotSet);
- }
- set {
- ViewState ["CaptionAlign"] = value;
- }
+ public virtual TableCaptionAlign CaptionAlign {
+ get { return (TableCaptionAlign)ViewState.GetInt ("CaptionAlign", (int)TableCaptionAlign.NotSet); }
+ set { ViewState ["CaptionAlign"] = value; }
}
-#endif
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(2)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
public int CellPadding {
- get {
- return ViewState.GetInt ("CellPadding", 2);
- }
+ get { return ViewState.GetInt ("CellPadding", 2); }
set {
if (value < -1)
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(0)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
public int CellSpacing {
- get {
- return ViewState.GetInt ("CellSpacing", 0);
- }
+ get { return ViewState.GetInt ("CellSpacing", 0); }
set {
if (value < -1)
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(DayNameFormat.Short)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public DayNameFormat DayNameFormat {
- get {
- return (DayNameFormat) ViewState.GetInt ("DayNameFormat", (int) DayNameFormat.Short);
- }
+ get { return (DayNameFormat) ViewState.GetInt ("DayNameFormat", (int) DayNameFormat.Short); }
set {
if (value != DayNameFormat.FirstLetter && value != DayNameFormat.FirstTwoLetters &&
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(FirstDayOfWeek.Default)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public FirstDayOfWeek FirstDayOfWeek {
- get {
- return (FirstDayOfWeek) ViewState.GetInt ("FirstDayOfWeek", (int) FirstDayOfWeek.Default);
- }
+ get { return (FirstDayOfWeek) ViewState.GetInt ("FirstDayOfWeek", (int) FirstDayOfWeek.Default); }
set {
if (value < FirstDayOfWeek.Sunday || value > FirstDayOfWeek.Default) {
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(">")]
-#if NET_2_0
[Localizable (true)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public string NextMonthText {
- get {
- return ViewState.GetString ("NextMonthText", ">");
- }
-
- set {
- ViewState ["NextMonthText"] = value;
- }
+ get { return ViewState.GetString ("NextMonthText", ">"); }
+ set { ViewState ["NextMonthText"] = value; }
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(NextPrevFormat.CustomText)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public NextPrevFormat NextPrevFormat {
- get {
- return (NextPrevFormat) ViewState.GetInt ("NextPrevFormat", (int) NextPrevFormat.CustomText);
- }
+ get { return (NextPrevFormat) ViewState.GetInt ("NextPrevFormat", (int) NextPrevFormat.CustomText); }
set {
- if (value != NextPrevFormat.CustomText && value != NextPrevFormat.ShortMonth && value != NextPrevFormat.FullMonth) {
+ if (value != NextPrevFormat.CustomText && value != NextPrevFormat.ShortMonth && value != NextPrevFormat.FullMonth)
throw new ArgumentOutOfRangeException ("The specified day name format is not one of the DayNameFormat values.");
- }
ViewState ["NextPrevFormat"] = value;
}
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue("<")]
-#if NET_2_0
[Localizable (true)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public string PrevMonthText {
- get {
- return ViewState.GetString ("PrevMonthText", "<");
- }
-
- set {
- ViewState ["PrevMonthText"] = value;
- }
+ get { return ViewState.GetString ("PrevMonthText", "<"); }
+ set { ViewState ["PrevMonthText"] = value; }
}
-#if NET_2_0
[Bindable(true, BindingDirection.TwoWay)]
-#else
- [Bindable(true)]
-#endif
[DefaultValue("1/1/0001 12:00:00 AM")]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
return DateTime.MinValue;
}
- set {
- SelectedDates.SelectRange (value, value);
- }
+ set { SelectedDates.SelectRange (value, value); }
}
[Browsable(false)]
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(CalendarSelectionMode.Day)]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
public CalendarSelectionMode SelectionMode {
- get {
- return (CalendarSelectionMode) ViewState.GetInt ("SelectionMode", (int) CalendarSelectionMode.Day);
- }
+ get { return (CalendarSelectionMode) ViewState.GetInt ("SelectionMode", (int) CalendarSelectionMode.Day); }
set {
if (value != CalendarSelectionMode.Day && value != CalendarSelectionMode.DayWeek &&
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(">>")]
-#if NET_2_0
[Localizable (true)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public string SelectMonthText {
- get {
- return ViewState.GetString ("SelectMonthText", ">>");
- }
-
- set {
- ViewState ["SelectMonthText"] = value;
- }
+ get { return ViewState.GetString ("SelectMonthText", ">>"); }
+ set { ViewState ["SelectMonthText"] = value; }
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(">")]
-#if NET_2_0
[Localizable (true)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public string SelectWeekText {
- get {
- return ViewState.GetString ("SelectWeekText", ">");
- }
-
- set {
- ViewState ["SelectWeekText"] = value;
- }
+ get { return ViewState.GetString ("SelectWeekText", ">"); }
+ set { ViewState ["SelectWeekText"] = value; }
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(true)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public bool ShowDayHeader {
- get {
- return ViewState.GetBool ("ShowDayHeader", true);
- }
-
- set {
- ViewState ["ShowDayHeader"] = value;
- }
+ get { return ViewState.GetBool ("ShowDayHeader", true); }
+ set { ViewState ["ShowDayHeader"] = value; }
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(false)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public bool ShowGridLines {
- get {
- return ViewState.GetBool ("ShowGridLines", false);
- }
-
- set {
- ViewState ["ShowGridLines"] = value;
- }
+ get { return ViewState.GetBool ("ShowGridLines", false); }
+ set { ViewState ["ShowGridLines"] = value; }
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(true)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public bool ShowNextPrevMonth {
- get {
- return ViewState.GetBool ("ShowNextPrevMonth", true);
- }
-
- set {
- ViewState ["ShowNextPrevMonth"] = value;
- }
+ get { return ViewState.GetBool ("ShowNextPrevMonth", true); }
+ set { ViewState ["ShowNextPrevMonth"] = value; }
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(true)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public bool ShowTitle {
- get {
- return ViewState.GetBool ("ShowTitle", true);
- }
-
- set {
- ViewState ["ShowTitle"] = value;
- }
+ get { return ViewState.GetBool ("ShowTitle", true); }
+ set { ViewState ["ShowTitle"] = value; }
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(TitleFormat.MonthYear)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public TitleFormat TitleFormat {
- get {
- return (TitleFormat) ViewState.GetInt ("TitleFormat", (int) TitleFormat.MonthYear);
- }
+ get { return (TitleFormat) ViewState.GetInt ("TitleFormat", (int) TitleFormat.MonthYear); }
set {
if (value != TitleFormat.Month && value != TitleFormat.MonthYear) {
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[WebSysDescription ("")]
return today;
}
- set {
- ViewState ["TodaysDate"] = value.Date;
- }
+ set { ViewState ["TodaysDate"] = value.Date; }
}
-#if NET_2_0
[DefaultValue (true)]
[WebSysDescription ("")]
[WebCategoryAttribute ("Accessibility")]
- public virtual bool UseAccessibleHeader
- {
- get {
- return ViewState.GetBool ("UseAccessibleHeader", true);
- }
- set {
- ViewState ["UseAccessibleHeader"] = value;
- }
+ public virtual bool UseAccessibleHeader {
+ get { return ViewState.GetBool ("UseAccessibleHeader", true); }
+ set { ViewState ["UseAccessibleHeader"] = value; }
}
-#endif
[Bindable(true)]
[DefaultValue("1/1/0001 12:00:00 AM")]
return DateTime.MinValue;
}
- set {
- ViewState ["VisibleDate"] = value.Date;
- }
+ set { ViewState ["VisibleDate"] = value.Date; }
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
return false;
}
-#if NET_2_0
void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
{
RaisePostBackEvent (eventArgument);
}
protected virtual void RaisePostBackEvent (string arg)
-#else
- void IPostBackEventHandler.RaisePostBackEvent (string arg)
-#endif
{
-#if NET_2_0
ValidateEvent (UniqueID, arg);
-#endif
if (arg.Length < 1)
return;
protected virtual void OnDayRender (TableCell cell, CalendarDay day)
{
DayRenderEventHandler eh = (DayRenderEventHandler) (Events [DayRenderEvent]);
- if (eh != null)
-#if NET_2_0
- if (Page != null)
- eh (this, new DayRenderEventArgs (cell, day, Page.ClientScript.GetPostBackClientHyperlink (this, GetDaysFromZenith (day.Date).ToString (), true)));
+ if (eh != null) {
+ Page page = Page;
+ if (page != null)
+ eh (this, new DayRenderEventArgs (cell, day, page.ClientScript.GetPostBackClientHyperlink (this, GetDaysFromZenith (day.Date).ToString (), true)));
else
-#endif
- eh (this, new DayRenderEventArgs (cell, day));
+ eh (this, new DayRenderEventArgs (cell, day));
+ }
}
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void OnPreRender (EventArgs e)
+ protected internal override void OnPreRender (EventArgs e)
{
base.OnPreRender (e);
}
eh (this, new MonthChangedEventArgs (newDate, previousDate));
}
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void Render (HtmlTextWriter writer)
+ protected internal override void Render (HtmlTextWriter writer)
{
TableStyle ts = new TableStyle ();
ts.CellSpacing = CellSpacing;
writer.AddAttribute (HtmlTextWriterAttribute.Id, ClientID);
writer.RenderBeginTag (HtmlTextWriterTag.Table);
-#if NET_2_0
if (!String.IsNullOrEmpty (Caption))
WriteCaption (writer);
-#endif
+
bool enabled = IsEnabled;
if (ShowTitle)
states [0] = base.SaveViewState ();
for (int i = 0; i < states.Length; i++) {
- if (states [i] != null) {
+ if (states [i] != null)
return states;
- }
}
return null;
DayOfWeek dayOfWeek = (DayOfWeek) i;
dayName = dti.GetDayName (dayOfWeek);
-#if NET_2_0
if (UseAccessibleHeader) {
writer.AddAttribute (HtmlTextWriterAttribute.Abbr, dayName);
writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col", false);
cell = new TableHeaderCell();
- }
- else
-#endif
+ } else
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Center;
cell.RenderBeginTag (writer);
switch (DayNameFormat) {
- case DayNameFormat.FirstLetter:
- dayName = dayName.Substring (0, 1);
- break;
- case DayNameFormat.FirstTwoLetters:
- dayName = dayName.Substring (0, 2);
- break;
-#if NET_2_0
- case DayNameFormat.Shortest:
- dayName = dti.GetShortestDayName (dayOfWeek);
- break;
-#endif
- case DayNameFormat.Full:
- break;
- case DayNameFormat.Short:
- default:
- dayName = dti.GetAbbreviatedDayName (dayOfWeek);
- break;
+ case DayNameFormat.FirstLetter:
+ dayName = dayName.Substring (0, 1);
+ break;
+ case DayNameFormat.FirstTwoLetters:
+ dayName = dayName.Substring (0, 2);
+ break;
+ case DayNameFormat.Shortest:
+ dayName = dti.GetShortestDayName (dayOfWeek);
+ break;
+ case DayNameFormat.Full:
+ break;
+ case DayNameFormat.Short:
+ default:
+ dayName = dti.GetAbbreviatedDayName (dayOfWeek);
+ break;
}
writer.Write (dayName);
cell.RenderEndTag (writer);
- if (i >= daysInAWeek - 1) {
+ if (i >= daysInAWeek - 1)
i = 0;
- }
- else {
+ else
i++;
- }
+
if (i == first)
break;
}
OnDayRender (cell, day);
- if (dayStyle != null && !dayStyle.IsEmpty) {
+ if (dayStyle != null && !dayStyle.IsEmpty)
style.CopyFrom (dayStyle);
- }
- if (day.IsWeekend && weekendDayStyle != null && !weekendDayStyle.IsEmpty) {
+ if (day.IsWeekend && weekendDayStyle != null && !weekendDayStyle.IsEmpty)
style.CopyFrom (weekendDayStyle);
- }
- if (day.IsToday && todayDayStyle != null && !todayDayStyle.IsEmpty) {
+ if (day.IsToday && todayDayStyle != null && !todayDayStyle.IsEmpty)
style.CopyFrom (todayDayStyle);
- }
- if (day.IsOtherMonth && otherMonthDayStyle != null && !otherMonthDayStyle.IsEmpty) {
+ if (day.IsOtherMonth && otherMonthDayStyle != null && !otherMonthDayStyle.IsEmpty)
style.CopyFrom (otherMonthDayStyle);
- }
if (enabled && day.IsSelected) {
style.BackColor = Color.Silver;
style.ForeColor = Color.White;
- if (selectedDayStyle != null && !selectedDayStyle.IsEmpty) {
+ if (selectedDayStyle != null && !selectedDayStyle.IsEmpty)
style.CopyFrom (selectedDayStyle);
- }
}
cell.ApplyStyle (style);
{
StringBuilder str = new StringBuilder ();
Color clr;
- hasLink = (Page != null && hasLink == true) ? true : false;
+ Page page = Page;
+ hasLink = (page != null && hasLink == true) ? true : false;
if (hasLink) {
str.Append ("<a href=\"");
-#if NET_2_0
- str.Append (Page.ClientScript.GetPostBackClientHyperlink (this, arg, true));
-#else
- str.Append (Page.ClientScript.GetPostBackClientHyperlink (this, arg));
-#endif
+ str.Append (page.ClientScript.GetPostBackClientHyperlink (this, arg, true));
str.Append ('\"');
- if (!foreColor.IsEmpty) {
+ if (!foreColor.IsEmpty)
clr = foreColor;
- } else {
+ else {
if (ForeColor.IsEmpty)
clr = Color.Black;
else
str.Append ("\">");
str.Append (text);
str.Append ("</a>");
- }
- else
+ } else
str.Append (text);
return str.ToString ();
return span.Days;
}
-#if NET_2_0
void WriteCaption (HtmlTextWriter writer)
{
if (CaptionAlign != TableCaptionAlign.NotSet)
writer.Write (Caption);
writer.RenderEndTag ();
}
-#endif
void WriteTitle (HtmlTextWriter writer, bool enabled)
{
titleCell.ColumnSpan = HasWeekSelectors (SelectionMode) ? 8 : 7;
- if (titleStyle != null && !titleStyle.IsEmpty && !titleStyle.BackColor.IsEmpty) {
+ if (titleStyle != null && !titleStyle.IsEmpty && !titleStyle.BackColor.IsEmpty)
titleCell.BackColor = titleStyle.BackColor;
- } else {
+ else
titleCell.BackColor = Color.Silver;
- }
titleCell.RenderBeginTag (writer);
// Table
tableTitle.Width = Unit.Percentage (100);
- if (titleStyle != null && !titleStyle.IsEmpty) {
+ if (titleStyle != null && !titleStyle.IsEmpty)
tableTitle.ApplyStyle (titleStyle);
- }
tableTitle.RenderBeginTag (writer);
writer.RenderBeginTag (HtmlTextWriterTag.Tr);
tableTitle.RenderEndTag (writer);
titleCell.RenderEndTag (writer);
writer.RenderEndTag (); //tr
-
}
-
string GetNextPrevFormatText (DateTime date, bool next)
{
string text;
[WebSysDescription ("")]
[WebCategory ("Action")]
public event DayRenderEventHandler DayRender {
- add {
- Events.AddHandler (DayRenderEvent, value);
- }
- remove {
- Events.RemoveHandler (DayRenderEvent, value);
- }
+ add { Events.AddHandler (DayRenderEvent, value); }
+ remove { Events.RemoveHandler (DayRenderEvent, value); }
}
[WebSysDescription ("")]
[WebCategory ("Action")]
public event EventHandler SelectionChanged {
- add {
- Events.AddHandler (SelectionChangedEvent, value);
- }
- remove {
- Events.RemoveHandler (SelectionChangedEvent, value);
- }
+ add { Events.AddHandler (SelectionChangedEvent, value); }
+ remove { Events.RemoveHandler (SelectionChangedEvent, value); }
}
[WebSysDescription ("")]
[WebCategory ("Action")]
public event MonthChangedEventHandler VisibleMonthChanged {
- add {
- Events.AddHandler (VisibleMonthChangedEvent, value);
- }
- remove {
- Events.RemoveHandler (VisibleMonthChangedEvent, value);
- }
+ add { Events.AddHandler (VisibleMonthChangedEvent, value); }
+ remove { Events.RemoveHandler (VisibleMonthChangedEvent, value); }
}
}
}
-
// Author:
// Jordi Mas i Hernandez <jordi@ximian.com>
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-namespace System.Web.UI.WebControls {
-
-#if !NET_2_0
- [Serializable]
-#endif
- public enum CalendarSelectionMode {
+namespace System.Web.UI.WebControls
+{
+ public enum CalendarSelectionMode
+ {
None,
Day,
DayWeek,
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Web.Security;
using System.Collections.Generic;
#region Public Properties
[DefaultValue (1)]
- public virtual int BorderPadding
- {
+ public virtual int BorderPadding {
get { return ViewState.GetInt ("BorderPadding", 1); }
- set
- {
+ set {
if (value < -1)
throw new ArgumentOutOfRangeException ();
ViewState ["BorderPadding"] = value;
}
[DefaultValue ("")]
- public virtual string CancelButtonImageUrl
- {
+ public virtual string CancelButtonImageUrl {
get { return ViewState.GetString ("CancelButtonImageUrl", String.Empty); }
set { ViewState ["CancelButtonImageUrl"] = value; }
}
[PersistenceMode (PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[NotifyParentProperty (true)]
- public Style CancelButtonStyle
- {
- get
- {
+ public Style CancelButtonStyle {
+ get {
if (_cancelButtonStyle == null) {
_cancelButtonStyle = new Style ();
if (IsTrackingViewState)
}
[Localizable (true)]
- public virtual string CancelButtonText
- {
+ public virtual string CancelButtonText {
get { return ViewState.GetString ("CancelButtonText", "Cancel"); }
set { ViewState ["CancelButtonText"] = value; }
}
- public virtual ButtonType CancelButtonType
- {
+ public virtual ButtonType CancelButtonType {
get { return ViewState ["CancelButtonType"] == null ? ButtonType.Button : (ButtonType) ViewState ["CancelButtonType"]; }
set { ViewState ["CancelButtonType"] = value; }
}
[Themeable (false)]
- public virtual string CancelDestinationPageUrl
- {
+ public virtual string CancelDestinationPageUrl {
get { return ViewState.GetString ("CancelDestinationPageUrl", String.Empty); }
set { ViewState ["CancelDestinationPageUrl"] = value; }
}
- public virtual string ChangePasswordButtonImageUrl
- {
+ public virtual string ChangePasswordButtonImageUrl {
get { return ViewState.GetString ("ChangePasswordButtonImageUrl", String.Empty); }
set { ViewState ["ChangePasswordButtonImageUrl"] = value; }
}
[PersistenceMode (PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[NotifyParentProperty (true)]
- public Style ChangePasswordButtonStyle
- {
- get
- {
+ public Style ChangePasswordButtonStyle {
+ get {
if (_changePasswordButtonStyle == null) {
_changePasswordButtonStyle = new Style ();
if (IsTrackingViewState)
}
[Localizable (true)]
- public virtual string ChangePasswordButtonText
- {
+ public virtual string ChangePasswordButtonText {
get { return ViewState.GetString ("ChangePasswordButtonText", "Change Password"); }
set { ViewState ["ChangePasswordButtonText"] = value; }
}
- public virtual ButtonType ChangePasswordButtonType
- {
+ public virtual ButtonType ChangePasswordButtonType {
get { return ViewState ["ChangePasswordButtonType"] == null ? ButtonType.Button : (ButtonType) ViewState ["ChangePasswordButtonType"]; }
set { ViewState ["ChangePasswordButtonType"] = value; }
}
[Localizable (true)]
- public virtual string ChangePasswordFailureText
- {
+ public virtual string ChangePasswordFailureText {
get { return ViewState.GetString ("ChangePasswordFailureText", "Your attempt to change passwords was unsuccessful. Please try again."); }
set { ViewState ["ChangePasswordFailureText"] = value; }
}
[Browsable (false)]
[PersistenceMode (PersistenceMode.InnerProperty)]
[TemplateContainer (typeof (ChangePassword))]
- public virtual ITemplate ChangePasswordTemplate
- {
+ public virtual ITemplate ChangePasswordTemplate {
get { return _changePasswordTemplate; }
set { _changePasswordTemplate = value; }
}
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public Control ChangePasswordTemplateContainer
- {
- get
- {
+ public Control ChangePasswordTemplateContainer {
+ get {
if (_changePasswordTemplateContainer == null)
_changePasswordTemplateContainer = new ChangePasswordContainer (this);
return _changePasswordTemplateContainer;
}
[Localizable (true)]
- public virtual string ChangePasswordTitleText
- {
+ public virtual string ChangePasswordTitleText {
get { return ViewState.GetString ("ChangePasswordTitleText", "Change Your Password"); }
set { ViewState ["ChangePasswordTitleText"] = value; }
}
[Browsable (false)]
[Themeable (false)]
[Filterable (false)]
- public virtual string ConfirmNewPassword
- {
- get { return _newPasswordConfirm != null ? _newPasswordConfirm : ""; }
+ public virtual string ConfirmNewPassword {
+ get { return _newPasswordConfirm != null ? _newPasswordConfirm : String.Empty; }
}
[Localizable (true)]
- public virtual string ConfirmNewPasswordLabelText
- {
+ public virtual string ConfirmNewPasswordLabelText {
get { return ViewState.GetString ("ConfirmNewPasswordLabelText", "Confirm New Password:"); }
set { ViewState ["ConfirmNewPasswordLabelText"] = value; }
}
[Localizable (true)]
- public virtual string ConfirmPasswordCompareErrorMessage
- {
+ public virtual string ConfirmPasswordCompareErrorMessage {
get { return ViewState.GetString ("ConfirmPasswordCompareErrorMessage", "The Confirm New Password must match the New Password entry."); }
set { ViewState ["ConfirmPasswordCompareErrorMessage"] = value; }
}
[Localizable (true)]
- public virtual string ConfirmPasswordRequiredErrorMessage
- {
+ public virtual string ConfirmPasswordRequiredErrorMessage {
get { return ViewState.GetString ("ConfirmPasswordRequiredErrorMessage", String.Empty); }
set { ViewState ["ConfirmPasswordRequiredErrorMessage"] = value; }
}
- public virtual string ContinueButtonImageUrl
- {
+ public virtual string ContinueButtonImageUrl {
get { return ViewState.GetString ("ContinueButtonImageUrl", String.Empty); }
set { ViewState ["ContinueButtonImageUrl"] = value; }
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- public Style ContinueButtonStyle
- {
- get
- {
+ public Style ContinueButtonStyle {
+ get {
if (_continueButtonStyle == null) {
_continueButtonStyle = new Style ();
if (IsTrackingViewState)
}
[Localizable (true)]
- public virtual string ContinueButtonText
- {
+ public virtual string ContinueButtonText {
get { return ViewState.GetString ("ContinueButtonText", "Continue"); }
set { ViewState ["ContinueButtonText"] = value; }
}
- public virtual ButtonType ContinueButtonType
- {
+ public virtual ButtonType ContinueButtonType {
get { return ViewState ["ContinueButtonType"] == null ? ButtonType.Button : (ButtonType) ViewState ["ContinueButtonType"]; }
set { ViewState ["ContinueButtonType"] = value; }
}
[Themeable (false)]
- public virtual string ContinueDestinationPageUrl
- {
+ public virtual string ContinueDestinationPageUrl {
get { return ViewState.GetString ("ContinueDestinationPageUrl", String.Empty); }
set { ViewState ["ContinueDestinationPageUrl"] = value; }
}
- public virtual string CreateUserIconUrl
- {
+ public virtual string CreateUserIconUrl {
get { return ViewState.GetString ("CreateUserIconUrl", String.Empty); }
set { ViewState ["CreateUserIconUrl"] = value; }
}
[Localizable (true)]
- public virtual string CreateUserText
- {
+ public virtual string CreateUserText {
get { return ViewState.GetString ("CreateUserText", String.Empty); }
set { ViewState ["CreateUserText"] = value; }
}
- public virtual string CreateUserUrl
- {
+ public virtual string CreateUserUrl {
get { return ViewState.GetString ("CreateUserUrl", String.Empty); }
set { ViewState ["CreateUserUrl"] = value; }
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
[Themeable (false)]
- public virtual string CurrentPassword
- {
- get { return _currentPassword != null ? _currentPassword : ""; }
+ public virtual string CurrentPassword {
+ get { return _currentPassword != null ? _currentPassword : String.Empty; }
}
[DefaultValue (false)]
- public virtual bool DisplayUserName
- {
+ public virtual bool DisplayUserName {
get { return ViewState.GetBool ("DisplayUserName", false); }
set { ViewState ["DisplayUserName"] = value; }
}
- public virtual string EditProfileIconUrl
- {
+ public virtual string EditProfileIconUrl {
get { return ViewState.GetString ("EditProfileIconUrl", String.Empty); }
set { ViewState ["EditProfileIconUrl"] = value; }
}
[Localizable (true)]
- public virtual string EditProfileText
- {
+ public virtual string EditProfileText {
get { return ViewState.GetString ("EditProfileText", String.Empty); }
set { ViewState ["EditProfileText"] = value; }
}
- public virtual string EditProfileUrl
- {
+ public virtual string EditProfileUrl {
get { return ViewState.GetString ("EditProfileUrl", String.Empty); }
set { ViewState ["EditProfileUrl"] = value; }
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- public TableItemStyle FailureTextStyle
- {
- get
- {
+ public TableItemStyle FailureTextStyle {
+ get {
if (_failureTextStyle == null) {
_failureTextStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
}
- public virtual string HelpPageIconUrl
- {
+ public virtual string HelpPageIconUrl {
get { return ViewState.GetString ("HelpPageIconUrl", String.Empty); }
set { ViewState ["HelpPageIconUrl"] = value; }
}
[Localizable (true)]
- public virtual string HelpPageText
- {
+ public virtual string HelpPageText {
get { return ViewState.GetString ("HelpPageText", String.Empty); }
set { ViewState ["HelpPageText"] = value; }
}
- public virtual string HelpPageUrl
- {
+ public virtual string HelpPageUrl {
get { return ViewState.GetString ("HelpPageUrl", String.Empty); }
set { ViewState ["HelpPageUrl"] = value; }
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- public TableItemStyle HyperLinkStyle
- {
- get
- {
+ public TableItemStyle HyperLinkStyle {
+ get {
if (_hyperLinkStyle == null) {
_hyperLinkStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
[Localizable (true)]
- public virtual string InstructionText
- {
+ public virtual string InstructionText {
get { return ViewState.GetString ("InstructionText", String.Empty); }
set { ViewState ["InstructionText"] = value; }
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- public TableItemStyle InstructionTextStyle
- {
- get
- {
+ public TableItemStyle InstructionTextStyle {
+ get {
if (_instructionTextStyle == null) {
_instructionTextStyle = new TableItemStyle ();
if (IsTrackingViewState)
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- public TableItemStyle LabelStyle
- {
- get
- {
+ public TableItemStyle LabelStyle {
+ get {
if (_labelStyle == null) {
_labelStyle = new TableItemStyle ();
if (IsTrackingViewState)
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- public MailDefinition MailDefinition
- {
- get
- {
+ public MailDefinition MailDefinition {
+ get {
if (_mailDefinition == null) {
_mailDefinition = new MailDefinition ();
if (IsTrackingViewState)
[Themeable (false)]
[DefaultValue ("")]
- public virtual string MembershipProvider
- {
- get
- {
+ public virtual string MembershipProvider {
+ get {
object o = ViewState ["MembershipProvider"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+
+ set {
if (value == null)
ViewState.Remove ("MembershipProvider");
else
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Themeable (false)]
- public virtual string NewPassword
- {
- get { return _newPassword != null ? _newPassword : ""; }
+ public virtual string NewPassword {
+ get { return _newPassword != null ? _newPassword : String.Empty; }
}
[Localizable (true)]
- public virtual string NewPasswordLabelText
- {
+ public virtual string NewPasswordLabelText {
get { return ViewState.GetString ("NewPasswordLabelText", "New Password:"); }
set { ViewState ["NewPasswordLabelText"] = value; }
}
- public virtual string NewPasswordRegularExpression
- {
+ public virtual string NewPasswordRegularExpression {
get { return ViewState.GetString ("NewPasswordRegularExpression", String.Empty); }
set { ViewState ["NewPasswordRegularExpression"] = value; }
}
- public virtual string NewPasswordRegularExpressionErrorMessage
- {
+ public virtual string NewPasswordRegularExpressionErrorMessage {
get { return ViewState.GetString ("NewPasswordRegularExpressionErrorMessage", String.Empty); }
set { ViewState ["NewPasswordRegularExpressionErrorMessage"] = value; }
}
[Localizable (true)]
- public virtual string NewPasswordRequiredErrorMessage
- {
+ public virtual string NewPasswordRequiredErrorMessage {
get { return ViewState.GetString ("NewPasswordRequiredErrorMessage", "New Password is required."); }
set { ViewState ["NewPasswordRequiredErrorMessage"] = value; }
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- public TableItemStyle PasswordHintStyle
- {
- get
- {
+ public TableItemStyle PasswordHintStyle {
+ get {
if (_passwordHintStyle == null) {
_passwordHintStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
[Localizable (true)]
- public virtual string PasswordHintText
- {
+ public virtual string PasswordHintText {
get { return ViewState.GetString ("PasswordHintText", String.Empty); }
set { ViewState ["PasswordHintText"] = value; }
}
[Localizable (true)]
- public virtual string PasswordLabelText
- {
+ public virtual string PasswordLabelText {
get { return ViewState.GetString ("PasswordLabelText", "Password:"); }
set { ViewState ["PasswordLabelText"] = value; }
}
- public virtual string PasswordRecoveryIconUrl
- {
+ public virtual string PasswordRecoveryIconUrl {
get { return ViewState.GetString ("PasswordRecoveryIconUrl", String.Empty); }
set { ViewState ["PasswordRecoveryIconUrl"] = value; }
}
[Localizable (true)]
- public virtual string PasswordRecoveryText
- {
+ public virtual string PasswordRecoveryText {
get { return ViewState.GetString ("PasswordRecoveryText", String.Empty); }
set { ViewState ["PasswordRecoveryText"] = value; }
}
- public virtual string PasswordRecoveryUrl
- {
+ public virtual string PasswordRecoveryUrl {
get { return ViewState.GetString ("PasswordRecoveryUrl", String.Empty); }
set { ViewState ["PasswordRecoveryUrl"] = value; }
}
[Localizable (true)]
- public virtual string PasswordRequiredErrorMessage
- {
+ public virtual string PasswordRequiredErrorMessage {
get { return ViewState.GetString ("PasswordRequiredErrorMessage", String.Empty); }
set { ViewState ["PasswordRequiredErrorMessage"] = value; }
}
[Themeable (false)]
- public virtual string SuccessPageUrl
- {
+ public virtual string SuccessPageUrl {
get { return ViewState.GetString ("SuccessPageUrl", String.Empty); }
set { ViewState ["SuccessPageUrl"] = value; }
}
[PersistenceMode (PersistenceMode.InnerProperty)]
[TemplateContainer (typeof (ChangePassword))]
[Browsable (false)]
- public virtual ITemplate SuccessTemplate
- {
+ public virtual ITemplate SuccessTemplate {
get { return _successTemplate; }
set { _successTemplate = value; }
}
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public Control SuccessTemplateContainer
- {
- get
- {
+ public Control SuccessTemplateContainer {
+ get {
if (_successTemplateContainer == null)
_successTemplateContainer = new SuccessContainer (this);
return _successTemplateContainer;
}
[Localizable (true)]
- public virtual string SuccessText
- {
+ public virtual string SuccessText {
get { return ViewState.GetString ("SuccessText", "Your password has been changed!"); }
set { ViewState ["SuccessText"] = value; }
}
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle SuccessTextStyle
- {
- get
- {
+ public TableItemStyle SuccessTextStyle {
+ get {
if (_successTextStyle == null) {
_successTextStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
[Localizable (true)]
- public virtual string SuccessTitleText
- {
+ public virtual string SuccessTitleText {
get { return ViewState.GetString ("SuccessTitleText", "Change Password Complete"); }
set { ViewState ["SuccessTitleText"] = value; }
}
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public Style TextBoxStyle
- {
- get
- {
+ public Style TextBoxStyle {
+ get {
if (_textBoxStyle == null) {
_textBoxStyle = new Style ();
if (IsTrackingViewState)
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle TitleTextStyle
- {
- get
- {
+ public TableItemStyle TitleTextStyle {
+ get {
if (_titleTextStyle == null) {
_titleTextStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
[DefaultValue ("")]
- public virtual string UserName
- {
- get
- {
+ public virtual string UserName {
+ get {
if (_username == null && HttpContext.Current.Request.IsAuthenticated)
_username = HttpContext.Current.User.Identity.Name;
- return _username != null ? _username : "";
+ return _username != null ? _username : String.Empty;
}
set { _username = value; }
}
[Localizable (true)]
- public virtual string UserNameLabelText
- {
+ public virtual string UserNameLabelText {
get { return ViewState.GetString ("UserNameLabelText", "User Name:"); }
set { ViewState ["UserNameLabelText"] = value; }
}
[Localizable (true)]
- public virtual string UserNameRequiredErrorMessage
- {
+ public virtual string UserNameRequiredErrorMessage {
get { return ViewState.GetString ("UserNameRequiredErrorMessage", "User Name is required."); }
set { ViewState ["UserNameRequiredErrorMessage"] = value; }
}
[NotifyParentProperty (true)]
[PersistenceMode (PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public Style ValidatorTextStyle
- {
- get
- {
+ public Style ValidatorTextStyle {
+ get {
if (_validatorTextStyle == null) {
_validatorTextStyle = new Style ();
if (IsTrackingViewState)
bool res = false;
try {
res = MembershipProviderInternal.ChangePassword (UserName, CurrentPassword, NewPassword);
+ } catch {
}
- catch { }
if (res) {
-
OnChangedPassword (args);
_showContinue = true;
if (_mailDefinition != null)
SendMail (UserName, NewPassword);
- }
- else {
+ } else {
OnChangePasswordError (EventArgs.Empty);
string lastError = string.Format (
"Password incorrect or New Password invalid. New Password length minimum: {0}. Non-alphanumeric characters required: {1}.",
SmtpClient smtpClient = new SmtpClient ();
try {
smtpClient.Send (message);
- }
- catch (Exception e) {
+ } catch (Exception e) {
SendMailErrorEventArgs mailArgs = new SendMailErrorEventArgs (e);
OnSendMailError (mailArgs);
if (!mailArgs.Handled)
#region Properties
- protected override HtmlTextWriterTag TagKey
- {
+ protected override HtmlTextWriterTag TagKey {
get { return HtmlTextWriterTag.Table; }
}
- internal virtual MembershipProvider MembershipProviderInternal
- {
- get
- {
+ internal virtual MembershipProvider MembershipProviderInternal {
+ get {
if (_provider == null)
InitMemberShipProvider ();
protected internal override void LoadControlState (object savedState)
{
- if (savedState == null) return;
+ if (savedState == null)
+ return;
object [] state = (object []) savedState;
base.LoadControlState (state [0]);
protected override void LoadViewState (object savedState)
{
-
if (savedState == null)
return;
protected override void TrackViewState ()
{
-
base.TrackViewState ();
if (_cancelButtonStyle != null)
ProcessChangePasswordEvent (args);
return true;
}
+
if (args.CommandName == CancelButtonCommandName) {
ProcessCancelEvent (args);
return true;
}
+
if (args.CommandName == ContinueButtonCommandName) {
ProcessContinueEvent (args);
return true;
}
// Requried controls
- public IEditableTextControl UserNameTextBox
- {
- get
- {
+ public IEditableTextControl UserNameTextBox {
+ get {
Control c = FindControl ("UserName");
if (c == null)
throw new HttpException ("ChangePasswordTemplate does not contain an IEditableTextControl with ID UserName for the username, this is required if DisplayUserName=true.");
return c as IEditableTextControl;
}
}
- public IEditableTextControl CurrentPasswordTextBox
- {
- get
- {
+
+ public IEditableTextControl CurrentPasswordTextBox {
+ get {
Control c = FindControl ("CurrentPassword");
if (c == null)
throw new HttpException ("ChangePasswordTemplate does not contain an IEditableTextControl with ID CurrentPassword for the current password.");
return c as IEditableTextControl;
}
}
- public IEditableTextControl NewPasswordTextBox
- {
- get
- {
+
+ public IEditableTextControl NewPasswordTextBox {
+ get {
Control c = FindControl ("NewPassword");
if (c == null)
throw new HttpException ("ChangePasswordTemplate does not contain an IEditableTextControl with ID NewPassword for the new password.");
}
// Optional controls
- public IEditableTextControl ConfirmNewPasswordTextBox
- {
+ public IEditableTextControl ConfirmNewPasswordTextBox {
get { return FindControl ("ConfirmNewPassword") as IEditableTextControl; }
}
- public Control CancelButton
- {
+
+ public Control CancelButton {
get { return FindControl ("Cancel"); }
}
- public Control ChangePasswordButton
- {
+
+ public Control ChangePasswordButton {
get { return FindControl ("ChangePassword"); }
}
- public ITextControl FailureTextLiteral
- {
+
+ public ITextControl FailureTextLiteral {
get { return FindControl ("FailureText") as ITextControl; }
}
}
cell1.ApplyStyle (s1);
row.Controls.Add (cell1);
- }
- else {
+ } else {
cell0.ColumnSpan = 2;
cell0.HorizontalAlign = HorizontalAlign.Center;
if (s0 != null)
// Row #5
if (_owner.PasswordHintText.Length > 0) {
table.Controls.Add (
- CreateRow (new LiteralControl (""),
+ CreateRow (new LiteralControl (String.Empty),
new LiteralControl (_owner.PasswordHintText),
- new LiteralControl (""),
+ new LiteralControl (String.Empty),
null, _owner.PasswordHintStyle));
}
((IButtonControl) CancelButton).Text = _owner.CancelButtonText;
((IButtonControl) CancelButton).CausesValidation = false;
- table.Controls.Add (CreateRow (ChangePasswordButton, CancelButton, new LiteralControl (""), null, null));
+ table.Controls.Add (CreateRow (ChangePasswordButton, CancelButton, new LiteralControl (String.Empty), null, null));
// Row #10
TableRow linksRow = new TableRow ();
{
ID = "SuccessContainerID";
}
+
public Control ChangePasswordButton
{
get { return FindControl ("Continue"); }
}
}
-#endif
// Author:
// Dick Porter <dick@ximian.com>
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Security.Permissions;
using System.Web.Util;
-namespace System.Web.UI.WebControls {
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[DataBindingHandler ("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
[DefaultEvent ("CheckedChanged")]
[DefaultProperty ("Text")]
-#if NET_2_0
[ControlValueProperty ("Checked", null)]
[SupportsEventValidation]
-#endif
- public class CheckBox : WebControl, IPostBackDataHandler
-#if NET_2_0
- , ICheckBoxControl
-#endif
+ public class CheckBox : WebControl, IPostBackDataHandler, ICheckBoxControl
{
string render_type;
AttributeCollection common_attrs;
-
-#if NET_2_0
AttributeCollection inputAttributes;
StateBag inputAttributesState;
AttributeCollection labelAttributes;
StateBag labelAttributesState;
-#endif
public CheckBox () : base (HtmlTextWriterTag.Input)
{
}
[DefaultValue (false)]
-#if NET_2_0
[Themeable (false)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Behavior")]
- public virtual bool AutoPostBack
- {
- get {
- return (ViewState.GetBool ("AutoPostBack",
- false));
- }
- set {
- ViewState["AutoPostBack"] = value;
- }
+ public virtual bool AutoPostBack {
+ get { return (ViewState.GetBool ("AutoPostBack", false)); }
+ set { ViewState["AutoPostBack"] = value; }
}
-#if NET_2_0
[DefaultValue (false)]
[Themeable (false)]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
- public virtual bool CausesValidation
- {
+ public virtual bool CausesValidation {
get { return ViewState.GetBool ("CausesValidation", false); }
set { ViewState ["CausesValidation"] = value; }
}
-#endif
-
[DefaultValue (false)]
-#if NET_2_0
[Bindable (true, BindingDirection.TwoWay)]
[Themeable (false)]
-#else
- [Bindable (true)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Behavior")]
- public virtual bool Checked
- {
- get {
- return (ViewState.GetBool ("Checked", false));
- }
- set {
- ViewState["Checked"] = value;
- }
+ public virtual bool Checked {
+ get { return (ViewState.GetBool ("Checked", false)); }
+ set { ViewState["Checked"] = value; }
}
-#if NET_2_0
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public AttributeCollection InputAttributes
- {
+ public AttributeCollection InputAttributes {
get {
if (inputAttributes == null) {
if (inputAttributesState == null) {
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
- public AttributeCollection LabelAttributes
- {
+ public AttributeCollection LabelAttributes {
get {
if (labelAttributes == null) {
if (labelAttributesState == null) {
return labelAttributes;
}
}
-#endif
[DefaultValue ("")]
[Bindable (true)]
-#if NET_2_0
[Localizable (true)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Appearance")]
- public virtual string Text
- {
- get {
- return (ViewState.GetString ("Text",
- String.Empty));
- }
- set {
- ViewState["Text"] = value;
- }
+ public virtual string Text {
+ get { return (ViewState.GetString ("Text", String.Empty)); }
+ set { ViewState["Text"] = value; }
}
[DefaultValue (TextAlign.Right)]
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[WebSysDescription ("")]
[WebCategory ("Appearance")]
- public virtual TextAlign TextAlign
- {
+ public virtual TextAlign TextAlign {
get { return (TextAlign) ViewState.GetInt ("TextAlign", (int)TextAlign.Right); }
set {
if (value != TextAlign.Left &&
}
}
-#if NET_2_0
[Themeable (false)]
[DefaultValue ("")]
[WebSysDescription ("")]
[WebCategoryAttribute ("Behavior")]
- public virtual string ValidationGroup
- {
+ public virtual string ValidationGroup {
get { return ViewState.GetString ("ValidationGroup", String.Empty); }
set { ViewState["ValidationGroup"] = value; }
}
-#endif
static readonly object EventCheckedChanged = new object ();
[WebSysDescription ("")]
[WebCategory ("Action")]
- public event EventHandler CheckedChanged
- {
- add {
- Events.AddHandler (EventCheckedChanged, value);
- }
- remove {
- Events.RemoveHandler (EventCheckedChanged, value);
- }
+ public event EventHandler CheckedChanged {
+ add { Events.AddHandler (EventCheckedChanged, value); }
+ remove { Events.RemoveHandler (EventCheckedChanged, value); }
}
protected virtual void OnCheckedChanged (EventArgs e)
{
EventHandler handler = (EventHandler)Events[EventCheckedChanged];
- if (handler != null) {
+ if (handler != null)
handler (this, e);
- }
}
- internal virtual string NameAttribute
- {
- get {
- return (this.UniqueID);
- }
+ internal virtual string NameAttribute {
+ get { return (this.UniqueID); }
}
-#if NET_2_0
protected override void LoadViewState (object savedState)
{
if (savedState == null) {
if (labelAttributesState != null)
labelAttributesState.TrackViewState ();
}
-#endif
-
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void OnPreRender (EventArgs e)
+
+ protected internal override void OnPreRender (EventArgs e)
{
base.OnPreRender (e);
Page page = Page;
if (page != null && IsEnabled) {
page.RegisterRequiresPostBack (this);
-#if NET_2_0
page.RegisterEnabledControl (this);
-#endif
}
}
{
attname = attname.ToUpper (Helpers.InvariantCulture);
switch (attname) {
- case "VALUE":
- case "CHECKED":
- case "SIZE":
- case "MAXLENGTH":
- case "SRC":
- case "ALT":
- case "USEMAP":
- case "DISABLED":
- case "READONLY":
- case "ACCEPT":
- case "ACCESSKEY":
- case "TABINDEX":
- case "ONFOCUS":
- case "ONBLUR":
- case "ONSELECT":
- case "ONCHANGE":
- case "ONCLICK":
- case "ONDBLCLICK":
- case "ONMOUSEDOWN":
- case "ONMOUSEUP":
- case "ONMOUSEOVER":
- case "ONMOUSEMOVE":
- case "ONMOUSEOUT":
- case "ONKEYPRESS":
- case "ONKEYDOWN":
- case "ONKEYUP":
- return true;
- default:
- return false;
+ case "VALUE":
+ case "CHECKED":
+ case "SIZE":
+ case "MAXLENGTH":
+ case "SRC":
+ case "ALT":
+ case "USEMAP":
+ case "DISABLED":
+ case "READONLY":
+ case "ACCEPT":
+ case "ACCESSKEY":
+ case "TABINDEX":
+ case "ONFOCUS":
+ case "ONBLUR":
+ case "ONSELECT":
+ case "ONCHANGE":
+ case "ONCLICK":
+ case "ONDBLCLICK":
+ case "ONMOUSEDOWN":
+ case "ONMOUSEUP":
+ case "ONMOUSEOVER":
+ case "ONMOUSEMOVE":
+ case "ONMOUSEOUT":
+ case "ONKEYPRESS":
+ case "ONKEYDOWN":
+ case "ONKEYUP":
+ return true;
+ default:
+ return false;
}
}
return false;
}
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void Render (HtmlTextWriter w)
+
+ protected internal override void Render (HtmlTextWriter w)
{
Page page = Page;
if (page != null) {
page.VerifyRenderingInServerForm (this);
-#if NET_2_0
page.ClientScript.RegisterForEventValidation (UniqueID);
-#endif
}
bool need_span = ControlStyleCreated && !ControlStyle.IsEmpty;
if (need_span) {
-#if NET_2_0
AddDisplayStyleAttribute (w);
-#endif
ControlStyle.AddAttributesToRender (w, this);
}
need_span = true;
}
-#if NET_2_0
if (HasAttributes && AddAttributesForSpan (w))
need_span = true;
-#else
- if (Attributes.Count > 0 && AddAttributesForSpan (w))
- need_span = true;
-#endif
if (need_span)
w.RenderBeginTag (HtmlTextWriterTag.Span);
if (nameAttr != null && nameAttr.Length > 0)
w.AddAttribute (HtmlTextWriterAttribute.Name, nameAttr);
InternalAddAttributesToRender (w, enabled);
-#if NET_2_0
AddAttributesToRender (w);
if (inputAttributes != null)
inputAttributes.AddAttributes (w);
-#endif
+
if (Checked)
w.AddAttribute (HtmlTextWriterAttribute.Checked, "checked", false);
if (AutoPostBack) {
-#if NET_2_0
- string onclick = Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true);
+ Page page = Page;
+ string onclick = page != null ? page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true) : String.Empty;
onclick = String.Concat ("setTimeout('", onclick.Replace ("\\", "\\\\").Replace ("'", "\\'"), "', 0)");
w.AddAttribute (HtmlTextWriterAttribute.Onclick, BuildScriptAttribute ("onclick", onclick));
-#else
- w.AddAttribute (HtmlTextWriterAttribute.Onclick,
- BuildScriptAttribute ("onclick", Page.ClientScript.GetPostBackEventReference (this, String.Empty)));
- w.AddAttribute ("language", "javascript", false);
-#endif
}
if (AccessKey.Length > 0)
w.RenderEndTag ();
}
- void RenderLabel (HtmlTextWriter w) {
+ void RenderLabel (HtmlTextWriter w)
+ {
string text = Text;
if (text.Length > 0) {
-#if NET_2_0
if (labelAttributes != null)
labelAttributes.AddAttributes (w);
-#endif
w.AddAttribute (HtmlTextWriterAttribute.For, ClientID);
w.RenderBeginTag (HtmlTextWriterTag.Label);
w.Write (text);
}
}
-#if NET_2_0
- protected virtual
-#endif
- bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+ protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
{
if (!IsEnabled)
return false;
return (false);
}
-#if NET_2_0
- protected virtual
-#endif
- void RaisePostDataChangedEvent ()
+ protected virtual void RaisePostDataChangedEvent ()
{
-#if NET_2_0
ValidateEvent (UniqueID, String.Empty);
- if (CausesValidation)
- Page.Validate (ValidationGroup);
-#endif
+ if (CausesValidation) {
+ Page page = Page;
+ if (page != null)
+ page.Validate (ValidationGroup);
+ }
+
OnCheckedChanged (EventArgs.Empty);
}
RaisePostDataChangedEvent ();
}
-#if NET_2_0
- PostBackOptions GetPostBackOptions () {
+ PostBackOptions GetPostBackOptions ()
+ {
PostBackOptions options = new PostBackOptions (this);
options.ActionUrl = null;
options.ValidationGroup = null;
options.Argument = String.Empty;
options.RequiresJavaScriptProtocol = false;
options.ClientSubmit = true;
- options.PerformValidation = CausesValidation && Page != null && Page.AreValidatorsUplevel (ValidationGroup);
+
+ Page page = Page;
+ options.PerformValidation = CausesValidation && page != null && page.AreValidatorsUplevel (ValidationGroup);
if (options.PerformValidation)
options.ValidationGroup = ValidationGroup;
protected override void AddAttributesToRender (HtmlTextWriter writer)
{
}
-#endif
internal virtual void InternalAddAttributesToRender (HtmlTextWriter w, bool enabled)
{
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Web.UI;
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class CheckBoxField : BoundField
set { throw GetNotSupportedPropException ("ApplyFormatInEditMode"); }
}
- [EditorBrowsableAttribute (EditorBrowsableState.Never)]
- [BrowsableAttribute (false)]
- [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
public override bool ConvertEmptyStringToNull {
get { throw GetNotSupportedPropException ("ConvertEmptyStringToNull"); }
set { throw GetNotSupportedPropException ("ConvertEmptyStringToNull"); }
}
- [EditorBrowsableAttribute (EditorBrowsableState.Never)]
- [BrowsableAttribute (false)]
- [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
public override string DataFormatString {
get { throw GetNotSupportedPropException ("DataFormatString"); }
set { throw GetNotSupportedPropException ("DataFormatString"); }
}
- [EditorBrowsableAttribute (EditorBrowsableState.Never)]
- [BrowsableAttribute (false)]
- [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
public override bool HtmlEncode {
get { throw GetNotSupportedPropException ("HtmlEncode"); }
set { throw GetNotSupportedPropException ("HtmlEncode"); }
}
- [EditorBrowsableAttribute (EditorBrowsableState.Never)]
- [BrowsableAttribute (false)]
- [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [EditorBrowsableAttribute (EditorBrowsableState.Never)]
+ [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
public override string NullDisplayText {
get { throw GetNotSupportedPropException ("NullDisplayText"); }
set { throw GetNotSupportedPropException ("NullDisplayText"); }
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public virtual string Text {
- get { return ViewState.GetString ("Text", ""); }
+ get { return ViewState.GetString ("Text", String.Empty); }
set {
ViewState ["Text"] = value;
OnFieldChanged ();
if (val != null && val != DBNull.Value)
box.Checked = (bool) val;
- else
+ else {
if (string.IsNullOrEmpty (DataField)) {
box.Visible = false;
return;
}
-
+ }
+
if (!box.Visible)
box.Visible = true;
} catch (HttpException) {
}
}
}
-#endif
+
// Authors:
// Jackson Harper (jackson@ximian.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Security.Permissions;
using System.Web.Util;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
Controls.Add (check_box);
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(-1)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
set { TableStyle.CellPadding = value; }
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(-1)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
set { TableStyle.CellSpacing = value; }
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(0)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(RepeatDirection.Vertical)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
public virtual RepeatDirection RepeatDirection {
- get {
- return (RepeatDirection) ViewState.GetInt ("RepeatDirection",
- (int) RepeatDirection.Vertical);
- }
+ get { return (RepeatDirection) ViewState.GetInt ("RepeatDirection", (int) RepeatDirection.Vertical); }
set {
if (value < RepeatDirection.Horizontal ||
value > RepeatDirection.Vertical)
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(RepeatLayout.Table)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
public virtual RepeatLayout RepeatLayout {
- get {
- return (RepeatLayout) ViewState.GetInt ("RepeatLayout",
- (int) RepeatLayout.Table);
- }
+ get { return (RepeatLayout) ViewState.GetInt ("RepeatLayout", (int) RepeatLayout.Table); }
set {
if (value < RepeatLayout.Table ||
value > RepeatLayout.Flow)
}
}
-#if ONLY_1_1
- [Bindable(true)]
-#endif
[DefaultValue(TextAlign.Right)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
public virtual TextAlign TextAlign {
- get {
- return (TextAlign) ViewState.GetInt ("TextAlign",
- (int) TextAlign.Right);
- }
+ get { return (TextAlign) ViewState.GetInt ("TextAlign", (int) TextAlign.Right); }
set {
if (value < TextAlign.Left || value > TextAlign.Right)
throw new ArgumentOutOfRangeException ("value");
return this;
}
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void OnPreRender (EventArgs e)
+ protected internal override void OnPreRender (EventArgs e)
{
base.OnPreRender (e);
// Register all of the checked controls so we can
// find out when they are unchecked.
+ Page page = Page;
for (int i = 0; i < Items.Count; i++) {
if (Items [i].Selected) {
check_box.ID = i.ToString (Helpers.InvariantCulture);
- Page.RegisterRequiresPostBack (check_box);
+ if (page != null)
+ page.RegisterRequiresPostBack (check_box);
}
}
}
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void Render (HtmlTextWriter writer)
+ protected internal override void Render (HtmlTextWriter writer)
{
-#if NET_2_0
if (Items.Count == 0)
return;
-#endif
+
RepeatInfo ri = new RepeatInfo ();
ri.RepeatColumns = RepeatColumns;
ri.RepeatDirection = RepeatDirection;
ti = TabIndex;
TabIndex = 0;
}
-#if NET_2_0
+
string ak = AccessKey;
check_box.AccessKey = ak;
this.AccessKey = null;
-#endif
ri.RenderRepeater (writer, this, TableStyle, this);
if (ti != 0)
TabIndex = ti;
-#if NET_2_0
this.AccessKey = ak;
-#endif
}
-#if NET_2_0
- protected virtual
-#endif
- bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+ protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
{
if (!IsEnabled)
return false;
-#if NET_2_0
+
EnsureDataBound ();
-#endif
int checkbox = -1;
try {
string val = postCollection [postDataKey];
bool ischecked = val == "on";
ListItem item = Items [checkbox];
-#if NET_2_0
- if (item.Enabled)
-#endif
+ if (item.Enabled) {
if (ischecked && !item.Selected) {
item.Selected = true;
return true;
item.Selected = false;
return true;
}
-
+ }
+
return false;
}
-#if NET_2_0
- protected virtual
-#endif
- void RaisePostDataChangedEvent ()
+ protected virtual void RaisePostDataChangedEvent ()
{
-#if NET_2_0
- if (CausesValidation)
- Page.Validate (ValidationGroup);
-#endif
+ if (CausesValidation) {
+ Page page = Page;
+ if (page != null)
+ page.Validate (ValidationGroup);
+ }
+
OnSelectedIndexChanged (EventArgs.Empty);
}
- bool IPostBackDataHandler.LoadPostData (string postDataKey,
- NameValueCollection postCollection)
+ bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
{
return LoadPostData (postDataKey, postCollection);
}
RaisePostDataChangedEvent ();
}
-#if NET_2_0
- protected virtual
-#endif
- bool HasFooter
- {
- get {
- return false;
- }
+ protected virtual bool HasFooter {
+ get { return false; }
}
bool IRepeatInfoUser.HasFooter {
get { return HasFooter; }
}
-#if NET_2_0
- protected virtual
-#endif
- bool HasHeader
- {
- get {
- return false;
- }
+ protected virtual bool HasHeader {
+ get { return false; }
}
bool IRepeatInfoUser.HasHeader {
get { return HasHeader; }
}
-
-#if NET_2_0
- protected virtual
-#endif
- bool HasSeparators
- {
- get {
- return false;
- }
+ protected virtual bool HasSeparators {
+ get { return false; }
}
bool IRepeatInfoUser.HasSeparators {
get { return HasSeparators; }
}
-#if NET_2_0
- protected virtual
-#endif
- int RepeatedItemCount
- {
- get {
- return Items.Count;
- }
+ protected virtual int RepeatedItemCount {
+ get { return Items.Count; }
}
int IRepeatInfoUser.RepeatedItemCount {
get { return RepeatedItemCount; }
}
-#if NET_2_0
- protected virtual
-#endif
- Style GetItemStyle (ListItemType itemType,
- int repeatIndex)
+ protected virtual Style GetItemStyle (ListItemType itemType, int repeatIndex)
{
return null;
}
- Style IRepeatInfoUser.GetItemStyle (ListItemType itemType,
- int repeatIndex)
+ Style IRepeatInfoUser.GetItemStyle (ListItemType itemType, int repeatIndex)
{
return GetItemStyle (itemType, repeatIndex);
}
-#if NET_2_0
- protected virtual
-#endif
- void RenderItem (ListItemType itemType,
- int repeatIndex,
- RepeatInfo repeatInfo,
- HtmlTextWriter writer)
+ protected virtual void RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
{
ListItem item = Items [repeatIndex];
check_box.Enabled = false;
else
check_box.Enabled = item.Enabled;
-#if NET_2_0
+
check_box.ValidationGroup = ValidationGroup;
check_box.CausesValidation = CausesValidation;
if (check_box.HasAttributes)
check_box.Attributes.Clear ();
if (item.HasAttributes)
check_box.Attributes.CopyFrom (item.Attributes);
-#endif
+
check_box.RenderControl (writer);
}
- void IRepeatInfoUser.RenderItem (ListItemType itemType,
- int repeatIndex, RepeatInfo repeatInfo,
- HtmlTextWriter writer)
+ void IRepeatInfoUser.RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
{
RenderItem (itemType, repeatIndex, repeatInfo, writer);
}
-#if NET_2_0
- protected internal override void VerifyMultiSelect()
- {
- //by default the ListControl will throw an exception in this method,
- //therefor we should override the method if the class is supporting
- //MultiSelect option.
- }
-#endif
- }
+
+ protected internal override void VerifyMultiSelect()
+ {
+ //by default the ListControl will throw an exception in this method,
+ //therefor we should override the method if the class is supporting
+ //MultiSelect option.
+ }
+ }
}
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
using System;
using System.Globalization;
using System.Web;
namespace System.Web.UI.WebControls
{
-#if NET_2_0
internal class ChildTable : Table
-#else
- internal class TableID : Table
-#endif
{
Control parent;
-#if NET_2_0
public ChildTable (Control parent)
-#else
- public TableID (Control parent)
-#endif
{
this.parent = parent;
}
}
}
}
-
-
-
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System.ComponentModel;
namespace System.Web.UI.WebControls
}
}
-#endif
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc.
+// (C) 2005-2010 Novell, Inc.
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Text;
}
}
}
-#endif
+
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Web.UI;
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class CommandField : ButtonFieldBase
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public virtual string CancelImageUrl {
- get { return ViewState.GetString ("CancelImageUrl", ""); }
+ get { return ViewState.GetString ("CancelImageUrl", String.Empty); }
set {
ViewState ["CancelImageUrl"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public virtual string DeleteImageUrl {
- get { return ViewState.GetString ("DeleteImageUrl", ""); }
+ get { return ViewState.GetString ("DeleteImageUrl", String.Empty); }
set {
ViewState ["DeleteImageUrl"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public virtual string EditImageUrl {
- get { return ViewState.GetString ("EditImageUrl", ""); }
+ get { return ViewState.GetString ("EditImageUrl", String.Empty); }
set {
ViewState ["EditImageUrl"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public virtual string InsertImageUrl {
- get { return ViewState.GetString ("InsertImageUrl", ""); }
+ get { return ViewState.GetString ("InsertImageUrl", String.Empty); }
set {
ViewState ["InsertImageUrl"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public virtual string NewImageUrl {
- get { return ViewState.GetString ("NewImageUrl", ""); }
+ get { return ViewState.GetString ("NewImageUrl", String.Empty); }
set {
ViewState ["NewImageUrl"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public virtual string SelectImageUrl {
- get { return ViewState.GetString ("SelectImageUrl", ""); }
+ get { return ViewState.GetString ("SelectImageUrl", String.Empty); }
set {
ViewState ["SelectImageUrl"] = value;
OnFieldChanged ();
[WebSysDescription ("")]
[WebCategoryAttribute ("Appearance")]
public virtual string UpdateImageUrl {
- get { return ViewState.GetString ("UpdateImageUrl", ""); }
+ get { return ViewState.GetString ("UpdateImageUrl", String.Empty); }
set {
ViewState ["UpdateImageUrl"] = value;
OnFieldChanged ();
}
}
- public override void InitializeCell (DataControlFieldCell cell,
- DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
+ public override void InitializeCell (DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
string index = rowIndex.ToString ();
- if (cellType == DataControlCellType.DataCell)
- {
+ if (cellType == DataControlCellType.DataCell) {
if ((rowState & DataControlRowState.Edit) != 0) {
if (ShowEditButton) {
cell.Controls.Add (CreateButton (UpdateText, UpdateImageUrl, DataControlCommands.UpdateCommandName, index));
}
}
}
-#endif
+
// Authors:
// Chris Toshok (toshok@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
// attributes
-#if NET_2_0
[ToolboxData("<{0}:CompareValidator runat=\"server\" ErrorMessage=\"CompareValidator\"></{0}:CompareValidator>")]
-#else
- [ToolboxData("<{0}:CompareValidator runat=server ErrorMessage=\"CompareValidator\"></{0}:CompareValidator>")]
-#endif
public class CompareValidator : BaseCompareValidator
{
public CompareValidator ()
protected override void AddAttributesToRender (HtmlTextWriter w)
{
if (RenderUplevel) {
-#if NET_2_0
RegisterExpandoAttribute (ClientID, "evaluationfunction", "CompareValidatorEvaluateIsValid");
if (ControlToCompare.Length > 0)
RegisterExpandoAttribute (ClientID, "controltocompare", GetControlRenderID (ControlToCompare));
if (ValueToCompare.Length > 0)
RegisterExpandoAttribute (ClientID, "valuetocompare", ValueToCompare, true);
RegisterExpandoAttribute (ClientID, "operator", Operator.ToString ());
-#else
- if (ControlToCompare != "")
- w.AddAttribute ("controltocompare", GetControlRenderID(ControlToCompare));
- if (ValueToCompare != "")
- w.AddAttribute ("valuetocompare", ValueToCompare);
- w.AddAttribute ("operator", Operator.ToString());
- w.AddAttribute ("evaluationfunction", "CompareValidatorEvaluateIsValid", false);
-#endif
}
base.AddAttributesToRender (w);
protected override bool ControlPropertiesValid ()
{
if ((this.Operator != ValidationCompareOperator.DataTypeCheck) && ControlToCompare.Length == 0 &&
- !BaseCompareValidator.CanConvert (this.ValueToCompare, this.Type, this.CultureInvariantValues))
- {
+ !BaseCompareValidator.CanConvert (this.ValueToCompare, this.Type, this.CultureInvariantValues)) {
throw new HttpException(
String.Format("Unable to convert the value: {0} as a {1}", ValueToCompare,
Enum.GetName(typeof(ValidationDataType), this.Type)));
if (ControlToCompare.Length > 0) {
if (string.CompareOrdinal (ControlToCompare, ControlToValidate) == 0)
throw new HttpException (String.Format ("Control '{0}' cannot have the same value '{1}' for both ControlToValidate and ControlToCompare.", ID, ControlToCompare));
- CheckControlValidationProperty (ControlToCompare, "");
+ CheckControlValidationProperty (ControlToCompare, String.Empty);
}
return base.ControlPropertiesValid ();
string compare;
/* ControlToCompare takes precendence, if it's set. */
- compare = (ControlToCompare != "" ? GetControlValidationValue (ControlToCompare) : ValueToCompare);
+ string controlToCompare = ControlToCompare;
+ compare = (!String.IsNullOrEmpty (controlToCompare) ? GetControlValidationValue (controlToCompare) : ValueToCompare);
return BaseCompareValidator.Compare (GetControlValidationValue (ControlToValidate), false,
compare, this.CultureInvariantValues,
[TypeConverter(typeof(System.Web.UI.WebControls.ValidatedControlConverter))]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
-#if NET_2_0
[Themeable (false)]
-#endif
public string ControlToCompare {
get { return ViewState.GetString ("ControlToCompare", String.Empty); }
set { ViewState["ControlToCompare"] = value; }
[DefaultValue(ValidationCompareOperator.Equal)]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
-#if NET_2_0
[Themeable (false)]
-#endif
public ValidationCompareOperator Operator {
get { return (ValidationCompareOperator)ViewState.GetInt ("Operator", (int)ValidationCompareOperator.Equal); }
set { ViewState ["Operator"] = (int)value; }
}
-#if !NET_2_0
[Bindable(true)]
-#endif
[DefaultValue("")]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
-#if NET_2_0
[Themeable (false)]
-#endif
public string ValueToCompare {
get { return ViewState.GetString ("ValueToCompare", String.Empty); }
set { ViewState ["ValueToCompare"] = value; }
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Web;
using System.Web.UI;
// MSDN: The StepType property overrides the WizardStepBase.StepType property to ensure that CompleteWizardStep is always set to the Complete value of
// the WizardStepType enumeration. Attempting to set the StepType property to a different value will result in an InvalidOperationException.
[ThemeableAttribute (false)]
- public override WizardStepType StepType
- {
+ public override WizardStepType StepType {
get { return WizardStepType.Complete; }
set { throw new InvalidOperationException (); }
}
[LocalizableAttribute (true)]
- public override string Title
- {
- get
- {
+ public override string Title {
+ get {
object o = ViewState ["TitleText"];
return (o == null) ? Locale.GetText ("Complete") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("TitleText");
else
}
-#endif
// Authors: Ben Maurer <bmaurer@novell.com>
// Chris Toshok <toshok@novell.com>
//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
// attributes
[Designer ("System.Web.UI.Design.WebControls.CompositeControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
- public abstract class CompositeControl : WebControl, INamingContainer, ICompositeControlDesignerAccessor {
-
+ public abstract class CompositeControl : WebControl, INamingContainer, ICompositeControlDesignerAccessor
+ {
protected CompositeControl ()
{
}
}
}
-#endif
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2005-2010 Novell, Inc (http://www.novell.com)
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Collections;
{
}
- public override ControlCollection Controls
- {
+ public override ControlCollection Controls {
get {
EnsureChildControls();
return base.Controls;
if (itemCount != null) {
object [] data = new object [(int) itemCount];
CreateChildControls (data, false);
- }
- else if (RequiresDataBinding)
+ } else if (RequiresDataBinding)
EnsureDataBound ();
}
protected abstract int CreateChildControls (IEnumerable dataSource, bool dataBinding);
}
}
-
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Collections.Generic;
using System.Text;
{
WebControl _container;
- public ContainedTable (WebControl container) {
+ public ContainedTable (WebControl container)
+ {
_container = container;
}
- protected override void AddAttributesToRender (HtmlTextWriter writer) {
-
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
ControlStyle.CopyFrom (_container.ControlStyle);
writer.AddAttribute (HtmlTextWriterAttribute.Id, _container.ClientID);
}
}
-#endif
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc.
+// (C) 2005-2010 Novell, Inc.
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.ComponentModel;
}
}
-#endif
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc.
+// (C) 2005-2010 Novell, Inc.
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Collections;
using System.Web.UI.WebControls;
{
string placeHolderID;
- public override void Init (TemplateParser parser,
- ControlBuilder parentBuilder,
- Type type,
- string tagName,
- string ID,
- IDictionary attribs)
+ public override void Init (TemplateParser parser, ControlBuilder parentBuilder, Type type,
+ string tagName, string ID, IDictionary attribs)
{
base.Init (parser, parentBuilder, type, tagName, ID, attribs);
placeHolderID = attribs ["ContentPlaceHolderID"] as string;
}
}
-#endif
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-namespace System.Web.UI.WebControls {
- public enum ContentDirection {
+namespace System.Web.UI.WebControls
+{
+ public enum ContentDirection
+ {
NotSet = 0,
LeftToRight = 1,
RightToLeft = 2
}
}
-#endif
+
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc.
+// (C) 2005-2010 Novell, Inc.
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Collections;
using System.ComponentModel;
}
}
-#endif
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc.
+// (C) 2005-2010 Novell, Inc.
//
//
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Collections;
using System.Web.UI.WebControls;
internal class ContentPlaceHolderBuilder: ControlBuilder
{
#if !TARGET_J2EE
- public override void Init (TemplateParser parser,
- ControlBuilder parentBuilder,
- Type type,
- string tagName,
- string ID,
- IDictionary attribs)
+ public override void Init (TemplateParser parser, ControlBuilder parentBuilder, Type type,
+ string tagName, string ID, IDictionary attribs)
{
string id = null, s;
foreach (object k in attribs.Keys) {
s = k as string;
if (String.IsNullOrEmpty (s))
continue;
+
if (String.Compare (s, "id", StringComparison.OrdinalIgnoreCase) == 0) {
id = attribs [s] as string;
break;
}
}
-#endif
// Authors:
// Sanjay Gupta (gsanjay@novell.com)
//
-// (C) 2004 Novell, Inc (http://www.novell.com)
+// (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-
-#if NET_2_0
using System;
using System.ComponentModel;
using System.Collections;
namespace System.Web.UI.WebControls
{
public class ControlIDConverter : StringConverter
-
{
public ControlIDConverter ()
{ }
return null;
}*/
- public override TypeConverter.StandardValuesCollection GetStandardValues
- (ITypeDescriptorContext context)
+ public override TypeConverter.StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
{
if (context == null)
return null;
}
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.ComponentModel;
using System.Reflection;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[DefaultPropertyAttribute ("ControlID")]
- public class ControlParameter : Parameter {
-
+ public class ControlParameter : Parameter
+ {
public ControlParameter () : base ()
{
}
[DefaultValueAttribute ("")]
[IDReferencePropertyAttribute (typeof(System.Web.UI.Control))]
public string ControlID {
- get { return ViewState.GetString ("ControlID", ""); }
+ get { return ViewState.GetString ("ControlID", String.Empty); }
set {
if (ControlID != value) {
ViewState ["ControlID"] = value;
[TypeConverterAttribute (typeof (ControlPropertyNameConverter))]
[WebCategoryAttribute ("Control")]
public string PropertyName {
- get { return ViewState.GetString ("PropertyName", ""); }
+ get { return ViewState.GetString ("PropertyName", String.Empty); }
set {
if (PropertyName != value) {
}
}
}
-#endif
+
// Authors:
// Lluis Sanchez Gual (lluis@novell.com)
//
-// (C) 2005 Novell, Inc (http://www.novell.com)
+// (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
namespace System.Web.UI.WebControls
}
}
}
-
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Text;
using System.ComponentModel;
-namespace System.Web.UI.WebControls {
-
+namespace System.Web.UI.WebControls
+{
[DefaultPropertyAttribute ("CookieName")]
- public class CookieParameter : Parameter {
-
+ public class CookieParameter : Parameter
+ {
public CookieParameter () : base ()
{
}
[DefaultValueAttribute ("")]
public string CookieName {
- get { return ViewState.GetString ("CookieName", ""); }
+ get { return ViewState.GetString ("CookieName", String.Empty); }
set {
if (CookieName != value) {
ViewState ["CookieName"] = value;
}
}
-#endif
+
// Authors:
// Sanjay Gupta (gsanjay@novell.com)
//
-// (C) 2004 Novell, Inc (http://www.novell.com)
+// (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
//
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System.Web.Security;
-namespace System.Web.UI.WebControls {
+namespace System.Web.UI.WebControls
+{
public class CreateUserErrorEventArgs : EventArgs
{
MembershipCreateStatus status;
}
}
}
-#endif
+
// Authors:
// Sanjay Gupta (gsanjay@novell.com)
//
-// (C) 2004 Novell, Inc (http://www.novell.com)
+// (C) 2004-2010 Novell, Inc (http://www.novell.com)
//
//
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-namespace System.Web.UI.WebControls {
+
+namespace System.Web.UI.WebControls
+{
public delegate void CreateUserErrorEventHandler (object sender, CreateUserErrorEventArgs e);
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Web;
using System.Web.UI;
#region Public Properties
- public override int ActiveStepIndex
- {
+ public override int ActiveStepIndex {
get { return base.ActiveStepIndex; }
set { base.ActiveStepIndex = value; }
}
[LocalizableAttribute (true)]
[ThemeableAttribute (false)]
- public virtual string Answer
- {
- get
- {
+ public virtual string Answer {
+ get {
object o = ViewState ["Answer"];
return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("Answer");
else
}
[LocalizableAttribute (true)]
- public virtual string AnswerLabelText
- {
- get
- {
+ public virtual string AnswerLabelText {
+ get {
object o = ViewState ["AnswerLabelText"];
return (o == null) ? Locale.GetText ("Security Answer:") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("AnswerLabelText");
else
}
[LocalizableAttribute (true)]
- public virtual string AnswerRequiredErrorMessage
- {
- get
- {
+ public virtual string AnswerRequiredErrorMessage {
+ get {
object o = ViewState ["AnswerRequiredErrorMessage"];
return (o == null) ? Locale.GetText ("Security answer is required.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("AnswerRequiredErrorMessage");
else
}
[ThemeableAttribute (false)]
- public virtual bool AutoGeneratePassword
- {
- get
- {
+ public virtual bool AutoGeneratePassword {
+ get {
object o = ViewState ["AutoGeneratePassword"];
return (o == null) ? false : (bool) o;
}
- set
- {
- ViewState ["AutoGeneratePassword"] = value;
- }
+ set { ViewState ["AutoGeneratePassword"] = value; }
}
- public CompleteWizardStep CompleteStep
- {
- get
- {
+ public CompleteWizardStep CompleteStep {
+ get {
if (_completeWizardStep == null) {
for (int i = 0; i < WizardSteps.Count; i++)
if (WizardSteps [i] is CompleteWizardStep) {
}
[LocalizableAttribute (true)]
- public virtual string CompleteSuccessText
- {
- get
- {
+ public virtual string CompleteSuccessText {
+ get {
object o = ViewState ["CompleteSuccessText"];
return (o == null) ? Locale.GetText ("Your account has been successfully created.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("CompleteSuccessText");
else
}
}
- public TableItemStyle CompleteSuccessTextStyle
- {
- get
- {
+ public TableItemStyle CompleteSuccessTextStyle {
+ get {
if (_completeSuccessTextStyle == null) {
_completeSuccessTextStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
}
- public virtual string ConfirmPassword
- {
+ public virtual string ConfirmPassword {
get { return _confirmPassword; }
}
[LocalizableAttribute (true)]
- public virtual string ConfirmPasswordCompareErrorMessage
- {
- get
- {
+ public virtual string ConfirmPasswordCompareErrorMessage {
+ get {
object o = ViewState ["ConfirmPasswordCompareErrorMessage"];
return (o == null) ? Locale.GetText ("The Password and Confirmation Password must match.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("ConfirmPasswordCompareErrorMessage");
else
}
[LocalizableAttribute (true)]
- public virtual string ConfirmPasswordLabelText
- {
- get
- {
+ public virtual string ConfirmPasswordLabelText {
+ get {
object o = ViewState ["ConfirmPasswordLabelText"];
return (o == null) ? Locale.GetText ("Confirm Password:") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("ConfirmPasswordLabelText");
else
}
[LocalizableAttribute (true)]
- public virtual string ConfirmPasswordRequiredErrorMessage
- {
- get
- {
+ public virtual string ConfirmPasswordRequiredErrorMessage {
+ get {
object o = ViewState ["ConfirmPasswordRequiredErrorMessage"];
return (o == null) ? Locale.GetText ("Confirm Password is required.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("ConfirmPasswordRequiredErrorMessage");
else
}
}
- public virtual string ContinueButtonImageUrl
- {
+ public virtual string ContinueButtonImageUrl {
get { return ViewState.GetString ("ContinueButtonImageUrl", String.Empty); }
set { ViewState ["ContinueButtonImageUrl"] = value; }
}
- public Style ContinueButtonStyle
- {
+ public Style ContinueButtonStyle {
get {
if (_continueButtonStyle == null) {
_continueButtonStyle = new Style ();
}
[LocalizableAttribute (true)]
- public virtual string ContinueButtonText
- {
+ public virtual string ContinueButtonText {
get { return ViewState.GetString ("ContinueButtonText", "Continue"); }
set { ViewState ["ContinueButtonText"] = value; }
}
- public virtual ButtonType ContinueButtonType
- {
+ public virtual ButtonType ContinueButtonType {
get {
object v = ViewState ["ContinueButtonType"];
return v != null ? (ButtonType) v : ButtonType.Button;
}
[ThemeableAttribute (false)]
- public virtual string ContinueDestinationPageUrl
- {
- get
- {
+ public virtual string ContinueDestinationPageUrl {
+ get {
object o = ViewState ["ContinueDestinationPageUrl"];
return (o == null) ? "" : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("ContinueDestinationPageUrl");
else
}
}
- public virtual string CreateUserButtonImageUrl
- {
+ public virtual string CreateUserButtonImageUrl {
get { return ViewState.GetString ("CreateUserButtonImageUrl", String.Empty); }
set { ViewState ["CreateUserButtonImageUrl"] = value; }
}
- public Style CreateUserButtonStyle
- {
+ public Style CreateUserButtonStyle {
get {
if (_createUserButtonStyle == null) {
_createUserButtonStyle = new Style ();
}
[LocalizableAttribute (true)]
- public virtual string CreateUserButtonText
- {
+ public virtual string CreateUserButtonText {
get { return ViewState.GetString ("CreateUserButtonText", "Create User"); }
set { ViewState ["CreateUserButtonText"] = value; }
}
- public virtual ButtonType CreateUserButtonType
- {
+ public virtual ButtonType CreateUserButtonType {
get {
object v = ViewState ["CreateUserButtonType"];
return v != null ? (ButtonType) v : ButtonType.Button;
}
- set {
- ViewState ["CreateUserButtonType"] = value;
- }
+ set { ViewState ["CreateUserButtonType"] = value; }
}
- public CreateUserWizardStep CreateUserStep
- {
- get
- {
+ public CreateUserWizardStep CreateUserStep {
+ get {
if (_createUserWizardStep == null) {
for (int i = 0; i < WizardSteps.Count; i++)
if (WizardSteps [i] is CreateUserWizardStep) {
}
[ThemeableAttribute (false)]
- public virtual bool DisableCreatedUser
- {
- get
- {
+ public virtual bool DisableCreatedUser {
+ get {
object o = ViewState ["DisableCreatedUser"];
return (o == null) ? false : (bool) o;
}
- set
- {
- ViewState ["DisableCreatedUser"] = value;
- }
+ set { ViewState ["DisableCreatedUser"] = value; }
}
- public override bool DisplaySideBar
- {
- get {
- return ViewState.GetBool ("DisplaySideBar", false);
- }
+ public override bool DisplaySideBar {
+ get { return ViewState.GetBool ("DisplaySideBar", false); }
set {
ViewState ["DisplaySideBar"] = value;
ChildControlsCreated = false;
}
[LocalizableAttribute (true)]
- public virtual string DuplicateEmailErrorMessage
- {
- get
- {
+ public virtual string DuplicateEmailErrorMessage {
+ get {
object o = ViewState ["DuplicateEmailErrorMessage"];
return (o == null) ? Locale.GetText ("The e-mail address that you entered is already in use. Please enter a different e-mail address.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("DuplicateEmailErrorMessage");
else
}
[LocalizableAttribute (true)]
- public virtual string DuplicateUserNameErrorMessage
- {
- get
- {
+ public virtual string DuplicateUserNameErrorMessage {
+ get {
object o = ViewState ["DuplicateUserNameErrorMessage"];
return (o == null) ? Locale.GetText ("Please enter a different user name.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("DuplicateUserNameErrorMessage");
else
}
}
- public virtual string EditProfileIconUrl
- {
- get
- {
+ public virtual string EditProfileIconUrl {
+ get {
object o = ViewState ["EditProfileIconUrl"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("EditProfileIconUrl");
else
}
[LocalizableAttribute (true)]
- public virtual string EditProfileText
- {
- get
- {
+ public virtual string EditProfileText {
+ get {
object o = ViewState ["EditProfileText"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("EditProfileText");
else
}
}
- public virtual string EditProfileUrl
- {
- get
- {
+ public virtual string EditProfileUrl {
+ get {
object o = ViewState ["EditProfileUrl"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("EditProfileUrl");
else
}
}
- public virtual string Email
- {
- get
- {
+ public virtual string Email {
+ get {
object o = ViewState ["Email"];
return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("Email");
else
}
[LocalizableAttribute (true)]
- public virtual string EmailLabelText
- {
- get
- {
+ public virtual string EmailLabelText {
+ get {
object o = ViewState ["EmailLabelText"];
return (o == null) ? Locale.GetText ("E-mail:") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("EmailLabelText");
else
}
}
- public virtual string EmailRegularExpression
- {
- get
- {
+ public virtual string EmailRegularExpression {
+ get {
object o = ViewState ["EmailRegularExpression"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("EmailRegularExpression");
else
}
}
- public virtual string EmailRegularExpressionErrorMessage
- {
- get
- {
+ public virtual string EmailRegularExpressionErrorMessage {
+ get {
object o = ViewState ["EmailRegularExpressionErrorMessage"];
return (o == null) ? Locale.GetText ("Please enter a different e-mail.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("EmailRegularExpressionErrorMessage");
else
}
[LocalizableAttribute (true)]
- public virtual string EmailRequiredErrorMessage
- {
- get
- {
+ public virtual string EmailRequiredErrorMessage {
+ get {
object o = ViewState ["EmailRequiredErrorMessage"];
return (o == null) ? Locale.GetText ("E-mail is required.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("EmailRequiredErrorMessage");
else
}
}
- public TableItemStyle ErrorMessageStyle
- {
- get
- {
+ public TableItemStyle ErrorMessageStyle {
+ get {
if (_errorMessageStyle == null) {
_errorMessageStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
}
- public virtual string HelpPageIconUrl
- {
- get
- {
+ public virtual string HelpPageIconUrl {
+ get {
object o = ViewState ["HelpPageIconUrl"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("HelpPageIconUrl");
else
}
[LocalizableAttribute (true)]
- public virtual string HelpPageText
- {
- get
- {
+ public virtual string HelpPageText {
+ get {
object o = ViewState ["HelpPageText"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("HelpPageText");
else
}
}
- public virtual string HelpPageUrl
- {
- get
- {
+ public virtual string HelpPageUrl {
+ get {
object o = ViewState ["HelpPageUrl"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("HelpPageUrl");
else
}
}
- public TableItemStyle HyperLinkStyle
- {
- get
- {
+ public TableItemStyle HyperLinkStyle {
+ get {
if (_hyperLinkStyle == null) {
_hyperLinkStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
[LocalizableAttribute (true)]
- public virtual string InstructionText
- {
- get
- {
+ public virtual string InstructionText {
+ get {
object o = ViewState ["InstructionText"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("InstructionText");
else
}
}
- public TableItemStyle InstructionTextStyle
- {
- get
- {
+ public TableItemStyle InstructionTextStyle {
+ get {
if (_instructionTextStyle == null) {
_instructionTextStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
[LocalizableAttribute (true)]
- public virtual string InvalidAnswerErrorMessage
- {
- get
- {
+ public virtual string InvalidAnswerErrorMessage {
+ get {
object o = ViewState ["InvalidAnswerErrorMessage"];
return (o == null) ? Locale.GetText ("Please enter a different security answer.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("InvalidAnswerErrorMessage");
else
}
[LocalizableAttribute (true)]
- public virtual string InvalidEmailErrorMessage
- {
- get
- {
+ public virtual string InvalidEmailErrorMessage {
+ get {
object o = ViewState ["InvalidEmailErrorMessage"];
return (o == null) ? Locale.GetText ("Please enter a valid e-mail address.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("InvalidEmailErrorMessage");
else
[MonoTODO ("take the values from membership provider")]
[LocalizableAttribute (true)]
- public virtual string InvalidPasswordErrorMessage
- {
- get
- {
+ public virtual string InvalidPasswordErrorMessage {
+ get {
object o = ViewState ["InvalidPasswordErrorMessage"];
return (o == null) ? Locale.GetText ("Password length minimum: {0}. Non-alphanumeric characters required: {1}.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("InvalidPasswordErrorMessage");
else
}
[LocalizableAttribute (true)]
- public virtual string InvalidQuestionErrorMessage
- {
- get
- {
+ public virtual string InvalidQuestionErrorMessage {
+ get {
object o = ViewState ["InvalidQuestionErrorMessage"];
return (o == null) ? Locale.GetText ("Please enter a different security question.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("InvalidQuestionErrorMessage");
else
}
}
- public TableItemStyle LabelStyle
- {
- get
- {
+ public TableItemStyle LabelStyle {
+ get {
if (_labelStyle == null) {
_labelStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
[ThemeableAttribute (false)]
- public virtual bool LoginCreatedUser
- {
- get
- {
+ public virtual bool LoginCreatedUser {
+ get {
object o = ViewState ["LoginCreatedUser"];
return (o == null) ? true : (bool) o;
}
- set
- {
+ set {
ViewState ["LoginCreatedUser"] = value;
}
}
}
[ThemeableAttribute (false)]
- public virtual string MembershipProvider
- {
- get
- {
+ public virtual string MembershipProvider {
+ get {
object o = ViewState ["MembershipProvider"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("MembershipProvider");
else
}
}
- internal virtual MembershipProvider MembershipProviderInternal
- {
- get
- {
+ internal virtual MembershipProvider MembershipProviderInternal {
+ get {
if (_provider == null)
InitMemberShipProvider ();
}
}
- public virtual string Password
- {
+ public virtual string Password {
get { return _password; }
}
- public TableItemStyle PasswordHintStyle
- {
- get
- {
+ public TableItemStyle PasswordHintStyle {
+ get {
if (_passwordHintStyle == null) {
_passwordHintStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
[LocalizableAttribute (true)]
- public virtual string PasswordHintText
- {
- get
- {
+ public virtual string PasswordHintText {
+ get {
object o = ViewState ["PasswordHintText"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("PasswordHintText");
else
}
[LocalizableAttribute (true)]
- public virtual string PasswordLabelText
- {
- get
- {
+ public virtual string PasswordLabelText {
+ get {
object o = ViewState ["PasswordLabelText"];
return (o == null) ? Locale.GetText ("Password:") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("PasswordLabelText");
else
}
}
- public virtual string PasswordRegularExpression
- {
- get
- {
+ public virtual string PasswordRegularExpression {
+ get {
object o = ViewState ["PasswordRegularExpression"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("PasswordRegularExpression");
else
}
}
- public virtual string PasswordRegularExpressionErrorMessage
- {
- get
- {
+ public virtual string PasswordRegularExpressionErrorMessage {
+ get {
object o = ViewState ["PasswordRegularExpressionErrorMessage"];
return (o == null) ? Locale.GetText ("Please enter a different password.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("PasswordRegularExpressionErrorMessage");
else
}
[LocalizableAttribute (true)]
- public virtual string PasswordRequiredErrorMessage
- {
- get
- {
+ public virtual string PasswordRequiredErrorMessage {
+ get {
object o = ViewState ["PasswordRequiredErrorMessage"];
return (o == null) ? Locale.GetText ("Password is required.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("PasswordRequiredErrorMessage");
else
[LocalizableAttribute (true)]
[ThemeableAttribute (false)]
- public virtual string Question
- {
- get
- {
+ public virtual string Question {
+ get {
object o = ViewState ["Question"];
return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("Question");
else
}
[LocalizableAttribute (true)]
- public virtual string QuestionLabelText
- {
- get
- {
+ public virtual string QuestionLabelText {
+ get {
object o = ViewState ["QuestionLabelText"];
return (o == null) ? Locale.GetText ("Security Question:") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("QuestionLabelText");
else
}
[LocalizableAttribute (true)]
- public virtual string QuestionRequiredErrorMessage
- {
- get
- {
+ public virtual string QuestionRequiredErrorMessage {
+ get {
object o = ViewState ["QuestionRequiredErrorMessage"];
return (o == null) ? Locale.GetText ("Security question is required.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("QuestionRequiredErrorMessage");
else
}
[ThemeableAttribute (false)]
- public virtual bool RequireEmail
- {
- get
- {
+ public virtual bool RequireEmail {
+ get {
object o = ViewState ["RequireEmail"];
return (o == null) ? true : (bool) o;
}
- set
- {
+ set {
ViewState ["RequireEmail"] = value;
}
}
[MonoTODO ("doesnt work")]
- public override string SkipLinkText
- {
- get
- {
+ public override string SkipLinkText {
+ get {
object o = ViewState ["SkipLinkText"];
- return (o == null) ? "" : (string) o;
+ return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("SkipLinkText");
else
}
}
- public Style TextBoxStyle
- {
- get
- {
+ public Style TextBoxStyle {
+ get {
if (_textBoxStyle == null) {
_textBoxStyle = new Style ();
if (IsTrackingViewState)
}
}
- public TableItemStyle TitleTextStyle
- {
- get
- {
+ public TableItemStyle TitleTextStyle {
+ get {
if (_titleTextStyle == null) {
_titleTextStyle = new TableItemStyle ();
if (IsTrackingViewState)
}
[LocalizableAttribute (true)]
- public virtual string UnknownErrorMessage
- {
- get
- {
+ public virtual string UnknownErrorMessage {
+ get {
object o = ViewState ["UnknownErrorMessage"];
return (o == null) ? Locale.GetText ("Your account was not created. Please try again.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("UnknownErrorMessage");
else
}
}
- public virtual string UserName
- {
- get
- {
+ public virtual string UserName {
+ get {
object o = ViewState ["UserName"];
return (o == null) ? String.Empty : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("UserName");
else
}
[LocalizableAttribute (true)]
- public virtual string UserNameLabelText
- {
- get
- {
+ public virtual string UserNameLabelText {
+ get {
object o = ViewState ["UserNameLabelText"];
return (o == null) ? Locale.GetText ("User Name:") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("UserNameLabelText");
else
}
[LocalizableAttribute (true)]
- public virtual string UserNameRequiredErrorMessage
- {
- get
- {
+ public virtual string UserNameRequiredErrorMessage {
+ get {
object o = ViewState ["UserNameRequiredErrorMessage"];
return (o == null) ? Locale.GetText ("User Name is required.") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("UserNameRequiredErrorMessage");
else
}
}
- public Style ValidatorTextStyle
- {
- get
- {
+ public Style ValidatorTextStyle {
+ get {
if (_validatorTextStyle == null) {
_validatorTextStyle = new Style ();
if (IsTrackingViewState)
}
[ThemeableAttribute (false)]
- public override WizardStepCollection WizardSteps
- {
+ public override WizardStepCollection WizardSteps {
get { return base.WizardSteps; }
}
#region Protected Properties
- protected internal bool QuestionAndAnswerRequired
- {
+ protected internal bool QuestionAndAnswerRequired {
get { return MembershipProviderInternal.RequiresQuestionAndAnswer; }
}
- public event EventHandler ContinueButtonClick
- {
+ public event EventHandler ContinueButtonClick {
add { Events.AddHandler (ContinueButtonClickEvent, value); }
remove { Events.RemoveHandler (ContinueButtonClickEvent, value); }
}
- public event EventHandler CreatedUser
- {
+ public event EventHandler CreatedUser {
add { Events.AddHandler (CreatedUserEvent, value); }
remove { Events.RemoveHandler (CreatedUserEvent, value); }
}
- public event CreateUserErrorEventHandler CreateUserError
- {
+ public event CreateUserErrorEventHandler CreateUserError {
add { Events.AddHandler (CreateUserErrorEvent, value); }
remove { Events.RemoveHandler (CreateUserErrorEvent, value); }
}
- public event LoginCancelEventHandler CreatingUser
- {
+ public event LoginCancelEventHandler CreatingUser {
add { Events.AddHandler (CreatingUserEvent, value); }
remove { Events.RemoveHandler (CreatingUserEvent, value); }
}
- public event MailMessageEventHandler SendingMail
- {
+ public event MailMessageEventHandler SendingMail {
add { Events.AddHandler (SendingMailEvent, value); }
remove { Events.RemoveHandler (SendingMailEvent, value); }
}
- public event SendMailErrorEventHandler SendMailError
- {
+ public event SendMailErrorEventHandler SendMailError {
add { Events.AddHandler (SendMailErrorEvent, value); }
remove { Events.RemoveHandler (SendMailErrorEvent, value); }
}
internal override void InstantiateTemplateStep (TemplatedWizardStep step)
{
- if (step is CreateUserWizardStep) {
+ if (step is CreateUserWizardStep)
InstantiateCreateUserWizardStep ((CreateUserWizardStep) step);
- }
- else if (step is CompleteWizardStep) {
+ else if (step is CompleteWizardStep)
InstantiateCompleteWizardStep ((CompleteWizardStep) step);
- }
- else {
+ else
base.InstantiateTemplateStep (step);
- }
}
void InstantiateCompleteWizardStep (CompleteWizardStep step)
{
CompleteStepContainer contentTemplateContainer = new CompleteStepContainer (this);
- if (step.ContentTemplate != null) {
+ if (step.ContentTemplate != null)
step.ContentTemplate.InstantiateIn (contentTemplateContainer.InnerCell);
- }
else {
new CompleteStepTemplate (this).InstantiateIn (contentTemplateContainer.InnerCell);
contentTemplateContainer.ConfirmDefaultTemplate ();
void InstantiateCreateUserWizardStep (CreateUserWizardStep step)
{
CreateUserStepContainer contentTemplateContainer = new CreateUserStepContainer (this);
- if (step.ContentTemplate != null) {
+ if (step.ContentTemplate != null)
step.ContentTemplate.InstantiateIn (contentTemplateContainer.InnerCell);
- }
else {
new CreateUserStepTemplate (this).InstantiateIn (contentTemplateContainer.InnerCell);
contentTemplateContainer.ConfirmDefaultTemplate ();
step.Controls.Add (contentTemplateContainer);
CreateUserNavigationContainer customNavigationTemplateContainer = new CreateUserNavigationContainer (this);
- if (step.CustomNavigationTemplate != null) {
+ if (step.CustomNavigationTemplate != null)
step.CustomNavigationTemplate.InstantiateIn (customNavigationTemplateContainer);
- }
else {
new CreateUserStepNavigationTemplate (this).InstantiateIn (customNavigationTemplateContainer);
customNavigationTemplateContainer.ConfirmDefaultTemplate ();
step.CustomNavigationTemplateContainer = customNavigationTemplateContainer;
}
- internal override ITemplate SideBarItemTemplate
- {
+ internal override ITemplate SideBarItemTemplate {
get { return new SideBarLabelTemplate (this); }
}
return base.OnBubbleEvent (source, e);
}
- void ProcessContinueEvent () {
+ void ProcessContinueEvent ()
+ {
OnContinueButtonClick (EventArgs.Empty);
- if (ContinueDestinationPageUrl.Length > 0) {
+ if (ContinueDestinationPageUrl.Length > 0)
Context.Response.Redirect (ContinueDestinationPageUrl);
- }
}
protected virtual void OnContinueButtonClick (EventArgs e)
{
if (Events != null) {
EventHandler eh = (EventHandler) Events [ContinueButtonClickEvent];
- if (eh != null) eh (this, e);
+ if (eh != null)
+ eh (this, e);
}
}
{
if (Events != null) {
EventHandler eh = (EventHandler) Events [CreatedUserEvent];
- if (eh != null) eh (this, e);
+ if (eh != null)
+ eh (this, e);
}
}
{
if (Events != null) {
CreateUserErrorEventHandler eh = (CreateUserErrorEventHandler) Events [CreateUserErrorEvent];
- if (eh != null) eh (this, e);
+ if (eh != null)
+ eh (this, e);
}
}
{
if (Events != null) {
LoginCancelEventHandler eh = (LoginCancelEventHandler) Events [CreatingUserEvent];
- if (eh != null) eh (this, e);
+ if (eh != null)
+ eh (this, e);
}
}
{
if (Events != null) {
MailMessageEventHandler eh = (MailMessageEventHandler) Events [SendingMailEvent];
- if (eh != null) eh (this, e);
+ if (eh != null)
+ eh (this, e);
}
}
#region ITemplate Members
- public void InstantiateIn (Control container) {
+ public void InstantiateIn (Control container)
+ {
Table t = new Table ();
t.CellPadding = 5;
t.CellSpacing = 5;
get { return FindControl ("ErrorMessage") as ITextControl; }
}
- protected override void UpdateState () {
+ protected override void UpdateState ()
+ {
// Row #0 - title
- if (String.IsNullOrEmpty (_createUserWizard.CreateUserStep.Title)) {
+ if (String.IsNullOrEmpty (_createUserWizard.CreateUserStep.Title))
((Table) InnerCell.Controls [0]).Rows [0].Visible = false;
- }
- else {
+ else
((Table) InnerCell.Controls [0]).Rows [0].Cells [0].Text = _createUserWizard.CreateUserStep.Title;
- }
// Row #1 - InstructionText
- if (String.IsNullOrEmpty (_createUserWizard.InstructionText)) {
+ if (String.IsNullOrEmpty (_createUserWizard.InstructionText))
((Table) InnerCell.Controls [0]).Rows [1].Visible = false;
- }
- else {
+ else
((Table) InnerCell.Controls [0]).Rows [1].Cells [0].Text = _createUserWizard.InstructionText;
- }
// Row #2
Label UserNameLabel = (Label) ((Table) InnerCell.Controls [0]).Rows [2].Cells [0].Controls [0];
((Table) InnerCell.Controls [0]).Rows [3].Visible = false;
((Table) InnerCell.Controls [0]).Rows [4].Visible = false;
((Table) InnerCell.Controls [0]).Rows [5].Visible = false;
- }
- else {
+ } else {
// Row #3
Label PasswordLabel = (Label) ((Table) InnerCell.Controls [0]).Rows [3].Cells [0].Controls [0];
PasswordLabel.Text = _createUserWizard.PasswordLabelText;
PasswordRequired.ToolTip = _createUserWizard.PasswordRequiredErrorMessage;
// Row #4
- if (String.IsNullOrEmpty (_createUserWizard.PasswordHintText)) {
+ if (String.IsNullOrEmpty (_createUserWizard.PasswordHintText))
((Table) InnerCell.Controls [0]).Rows [4].Visible = false;
- }
- else {
+ else
((Table) InnerCell.Controls [0]).Rows [4].Cells [1].Text = _createUserWizard.PasswordHintText;
- }
// Row #5
Label ConfirmPasswordLabel = (Label) ((Table) InnerCell.Controls [0]).Rows [5].Cells [0].Controls [0];
RequiredFieldValidator EmailRequired = (RequiredFieldValidator) FindControl ("EmailRequired");
EmailRequired.ErrorMessage = _createUserWizard.EmailRequiredErrorMessage;
EmailRequired.ToolTip = _createUserWizard.EmailRequiredErrorMessage;
- }
- else {
+ } else
((Table) InnerCell.Controls [0]).Rows [6].Visible = false;
- }
if (_createUserWizard.QuestionAndAnswerRequired) {
// Row #7
RequiredFieldValidator AnswerRequired = (RequiredFieldValidator) FindControl ("AnswerRequired");
AnswerRequired.ErrorMessage = _createUserWizard.AnswerRequiredErrorMessage;
AnswerRequired.ToolTip = _createUserWizard.AnswerRequiredErrorMessage;
- }
- else {
+ } else {
((Table) InnerCell.Controls [0]).Rows [7].Visible = false;
((Table) InnerCell.Controls [0]).Rows [8].Visible = false;
}
// Row #9
- if (_createUserWizard.AutoGeneratePassword) {
+ if (_createUserWizard.AutoGeneratePassword)
((Table) InnerCell.Controls [0]).Rows [9].Visible = false;
- }
else {
CompareValidator PasswordCompare = (CompareValidator) FindControl ("PasswordCompare");
PasswordCompare.ErrorMessage = _createUserWizard.ConfirmPasswordCompareErrorMessage;
}
// Row #10
- if (_createUserWizard.AutoGeneratePassword || String.IsNullOrEmpty (_createUserWizard.PasswordRegularExpression)) {
+ if (_createUserWizard.AutoGeneratePassword || String.IsNullOrEmpty (_createUserWizard.PasswordRegularExpression))
((Table) InnerCell.Controls [0]).Rows [10].Visible = false;
- }
else {
RegularExpressionValidator PasswordRegEx = (RegularExpressionValidator) FindControl ("PasswordRegEx");
PasswordRegEx.ValidationExpression = _createUserWizard.PasswordRegularExpression;
}
// Row #11
- if (!_createUserWizard.RequireEmail || String.IsNullOrEmpty (_createUserWizard.EmailRegularExpression)) {
+ if (!_createUserWizard.RequireEmail || String.IsNullOrEmpty (_createUserWizard.EmailRegularExpression))
((Table) InnerCell.Controls [0]).Rows [11].Visible = false;
- }
else {
RegularExpressionValidator EmailRegEx = (RegularExpressionValidator) FindControl ("EmailRegEx");
EmailRegEx.ErrorMessage = _createUserWizard.EmailRegularExpressionErrorMessage;
}
// Row #12
- if (String.IsNullOrEmpty (ErrorMessageLabel.Text)) {
+ if (String.IsNullOrEmpty (ErrorMessageLabel.Text))
((Table) InnerCell.Controls [0]).Rows [12].Visible = false;
- }
// Row #13
// HelpPageIconUrl
Image img = (Image) ((Table) InnerCell.Controls [0]).Rows [13].Cells [0].Controls [0];
- if (String.IsNullOrEmpty (_createUserWizard.HelpPageIconUrl)) {
+ if (String.IsNullOrEmpty (_createUserWizard.HelpPageIconUrl))
img.Visible = false;
- }
else {
img.ImageUrl = _createUserWizard.HelpPageIconUrl;
img.AlternateText = _createUserWizard.HelpPageText;
// HelpPageText
HyperLink link = (HyperLink) ((Table) InnerCell.Controls [0]).Rows [13].Cells [0].Controls [1];
- if (String.IsNullOrEmpty (_createUserWizard.HelpPageText)) {
+ if (String.IsNullOrEmpty (_createUserWizard.HelpPageText))
link.Visible = false;
- }
else {
link.Text = _createUserWizard.HelpPageText;
link.NavigateUrl = _createUserWizard.HelpPageUrl;
#region ITemplate Members
- TableRow CreateRow (Control c0, Control c1, Control c2, Style s0, Style s1) {
+ TableRow CreateRow (Control c0, Control c1, Control c2, Style s0, Style s1)
+ {
TableRow row = new TableRow ();
TableCell cell0 = new TableCell ();
TableCell cell1 = new TableCell ();
_createUserWizard.RegisterApplyStyle (cell1, s1);
row.Controls.Add (cell1);
- }
- else {
+ } else {
cell0.ColumnSpan = 2;
cell0.HorizontalAlign = HorizontalAlign.Center;
if (s0 != null)
return row;
}
- public void InstantiateIn (Control container) {
+ public void InstantiateIn (Control container)
+ {
Table table = new Table ();
table.ControlStyle.Width = Unit.Percentage (100);
table.ControlStyle.Height = Unit.Percentage (100);
table.Controls.Add (CreateRow (PasswordLabel, Password, PasswordRequired, _createUserWizard.LabelStyle, null));
// Row #4
- table.Controls.Add (CreateRow (new LiteralControl (""), new LiteralControl (""), new LiteralControl (""), null, _createUserWizard.PasswordHintStyle));
+ table.Controls.Add (CreateRow (new LiteralControl (String.Empty), new LiteralControl (String.Empty), new LiteralControl (String.Empty), null, _createUserWizard.PasswordHintStyle));
// Row #5
TextBox ConfirmPassword = new TextBox ();
protected override void UpdateState ()
{
// title
- if (String.IsNullOrEmpty (_createUserWizard.CompleteStep.Title)) {
+ if (String.IsNullOrEmpty (_createUserWizard.CompleteStep.Title))
((Table) InnerCell.Controls [0]).Rows [0].Visible = false;
- }
- else {
+ else
((Table) InnerCell.Controls [0]).Rows [0].Cells [0].Text = _createUserWizard.CompleteStep.Title;
- }
// CompleteSuccessText
- if (String.IsNullOrEmpty (_createUserWizard.CompleteSuccessText)) {
+ if (String.IsNullOrEmpty (_createUserWizard.CompleteSuccessText))
((Table) InnerCell.Controls [0]).Rows [1].Visible = false;
- }
- else {
+ else
((Table) InnerCell.Controls [0]).Rows [1].Cells [0].Text = _createUserWizard.CompleteSuccessText;
- }
// ContinueButton
UpdateNavButtonState ("ContinueButton" + _createUserWizard.ContinueButtonType, _createUserWizard.ContinueButtonText, _createUserWizard.ContinueButtonImageUrl, _createUserWizard.ContinueButtonStyle);
// EditProfileIconUrl
Image img = (Image) ((Table) InnerCell.Controls [0]).Rows [3].Cells [0].Controls [0];
- if (String.IsNullOrEmpty (_createUserWizard.EditProfileIconUrl)) {
+ if (String.IsNullOrEmpty (_createUserWizard.EditProfileIconUrl))
img.Visible = false;
- }
else {
img.ImageUrl = _createUserWizard.EditProfileIconUrl;
img.AlternateText = _createUserWizard.EditProfileText;
// EditProfileText
HyperLink link = (HyperLink) ((Table) InnerCell.Controls [0]).Rows [3].Cells [0].Controls [1];
- if (String.IsNullOrEmpty (_createUserWizard.EditProfileText)) {
+ if (String.IsNullOrEmpty (_createUserWizard.EditProfileText))
link.Visible = false;
- }
else {
link.Text = _createUserWizard.EditProfileText;
link.NavigateUrl = _createUserWizard.EditProfileUrl;
}
}
}
-
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Web;
using System.Web.UI;
}
[DefaultValueAttribute (false)]
- public override bool AllowReturn
- {
- get {
- return ViewState.GetBool ("AllowReturn", false);
- }
- set {
- ViewState ["AllowReturn"] = value;
- }
+ public override bool AllowReturn {
+ get { return ViewState.GetBool ("AllowReturn", false); }
+ set { ViewState ["AllowReturn"] = value; }
}
[LocalizableAttribute (true)]
- public override string Title
- {
- get
- {
+ public override string Title {
+ get {
object o = ViewState ["TitleText"];
return (o == null) ? Locale.GetText ("Sign Up for Your New Account") : (string) o;
}
- set
- {
+ set {
if (value == null)
ViewState.Remove ("TitleText");
else
// MSDN: If you attempt to change the StepType property to any value other than the Auto value of the WizardStepType enumeration, an
// InvalidOperationException will be thrown.
[ThemeableAttribute (false)]
- public override WizardStepType StepType
- {
+ public override WizardStepType StepType {
get { return WizardStepType.Auto; }
set { throw new InvalidOperationException (); }
}
}
}
-#endif
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
+// Copyright (c) 2005-2010 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Peter Bartok (pbartok@novell.com)
using System.ComponentModel;
using System.Security.Permissions;
-namespace System.Web.UI.WebControls {
+namespace System.Web.UI.WebControls
+{
// CAS
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
// attributes
[DefaultEvent("ServerValidate")]
-#if NET_2_0
[ToolboxData("<{0}:CustomValidator runat=\"server\" ErrorMessage=\"CustomValidator\"></{0}:CustomValidator>")]
-#else
- [ToolboxData("<{0}:CustomValidator runat=server ErrorMessage=\"CustomValidator\"></{0}:CustomValidator>")]
-#endif
- public class CustomValidator : BaseValidator {
+ public class CustomValidator : BaseValidator
+ {
static readonly object serverValidateEvent = new object ();
EventHandlerList events = new EventHandlerList ();
#region Events
[WebSysDescription ("")]
[WebCategory ("Behavior")]
- public event ServerValidateEventHandler ServerValidate {
+ public event ServerValidateEventHandler ServerValidate {
add { events.AddHandler (serverValidateEvent, value); }
remove { events.RemoveHandler (serverValidateEvent, value); }
}
#endregion // Events
#region Public Constructors
- public CustomValidator() {
+ public CustomValidator()
+ {
}
#endregion // Public Constructors
[DefaultValue("")]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
-#if NET_2_0
[Themeable (false)]
-#endif
public string ClientValidationFunction {
- get { return ViewState.GetString("ClientValidationFunction", ""); }
+ get { return ViewState.GetString("ClientValidationFunction", String.Empty); }
set { ViewState["ClientValidationFunction"] = value; }
}
-#if NET_2_0
[Themeable (false)]
[DefaultValue (false)]
public bool ValidateEmptyText {
get { return ViewState.GetBool ("ValidateEmptyText", false); }
set { ViewState ["ValidateEmptyText"] = value; }
}
-#endif
#endregion // Public Instance Properties
#region Public Instance Methods
- protected override void AddAttributesToRender(HtmlTextWriter writer) {
+ protected override void AddAttributesToRender (HtmlTextWriter writer)
+ {
base.AddAttributesToRender (writer);
if (base.RenderUplevel) {
string s;
-
-#if NET_2_0
+
RegisterExpandoAttribute (ClientID, "evaluationfunction", "CustomValidatorEvaluateIsValid");
if (ValidateEmptyText)
RegisterExpandoAttribute (ClientID, "validateemptytext", "true");
s = ClientValidationFunction;
if (!String.IsNullOrEmpty (s))
RegisterExpandoAttribute (ClientID, "clientvalidationfunction", s, true);
-#else
- writer.AddAttribute ("evaluationfunction", "CustomValidatorEvaluateIsValid", false);
-
- s = ClientValidationFunction;
- if (s != String.Empty)
- writer.AddAttribute("clientvalidationfunction", s);
-#endif
}
}
protected override bool ControlPropertiesValid ()
{
- if (ControlToValidate == "")
+ if (String.IsNullOrEmpty (ControlToValidate))
return true;
return base.ControlPropertiesValid ();
}
- protected override bool EvaluateIsValid() {
- if (ControlToValidate.Length > 0) {
- string value = GetControlValidationValue (ControlToValidate);
-#if NET_2_0
+ protected override bool EvaluateIsValid ()
+ {
+ string controlToValidate = ControlToValidate;
+ if (!String.IsNullOrEmpty (controlToValidate)) {
+ string value = GetControlValidationValue (controlToValidate);
if (String.IsNullOrEmpty (value) && !ValidateEmptyText)
return true;
-#endif
+
return OnServerValidate (value);
}
return OnServerValidate(string.Empty);
}
- protected virtual bool OnServerValidate(string value) {
+ protected virtual bool OnServerValidate (string value)
+ {
ServerValidateEventHandler eh = events [serverValidateEvent] as ServerValidateEventHandler;
if (eh != null) {
ServerValidateEventArgs e;