// 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) {
- cell.Controls.Add (CreateButton (UpdateText, UpdateImageUrl, DataControlCommands.UpdateCommandName, index));
- if (ShowCancelButton) {
- AddSeparator (cell);
- cell.Controls.Add (CreateButton (CancelText, CancelImageUrl, DataControlCommands.CancelCommandName, index));
+ if (ShowEditButton) {
+ cell.Controls.Add (CreateButton (UpdateText, UpdateImageUrl, DataControlCommands.UpdateCommandName, index));
+ if (ShowCancelButton) {
+ AddSeparator (cell);
+ cell.Controls.Add (CreateButton (CancelText, CancelImageUrl, DataControlCommands.CancelCommandName, index));
+ }
}
} else if ((rowState & DataControlRowState.Insert) != 0) {
- cell.Controls.Add (CreateButton (InsertText, InsertImageUrl, DataControlCommands.InsertCommandName, index));
- if (ShowCancelButton) {
- AddSeparator (cell);
- cell.Controls.Add (CreateButton (CancelText, CancelImageUrl, DataControlCommands.CancelCommandName, index));
+ if (ShowInsertButton) {
+ cell.Controls.Add (CreateButton (InsertText, InsertImageUrl, DataControlCommands.InsertCommandName, index));
+ if (ShowCancelButton) {
+ AddSeparator (cell);
+ cell.Controls.Add (CreateButton (CancelText, CancelImageUrl, DataControlCommands.CancelCommandName, index));
+ }
}
} else {
if (ShowEditButton) {
base.InitializeCell (cell, cellType, rowState, rowIndex);
}
- DataControlButton CreateButton (string text, string image, string command, string arg)
+ Control CreateButton (string text, string image, string command, string arg)
{
- DataControlButton c = new DataControlButton (Control, text, image, command, arg, false);
- c.CausesValidation = CausesValidation;
- return c;
+ IDataControlButton c = DataControlButton.CreateButton (ButtonType, Control, text, image, command, arg, false);
+ if (CausesValidation) {
+ if (command == DataControlCommands.UpdateCommandName || command == DataControlCommands.InsertCommandName) {
+ c.Container = null;
+ c.CausesValidation = true;
+ c.ValidationGroup = ValidationGroup;
+ }
+ }
+ return (Control)c;
}
void AddSeparator (DataControlFieldCell cell)
}
public override void ValidateSupportsCallback ()
- {\r
- if (ShowSelectButton)\r
- throw new NotSupportedException ("ShowSelectButton = true");
+ {
+ if (ShowSelectButton)
+ throw new NotSupportedException ("Callbacks are not supported on CommandField when the select button is enabled because other controls on your page that are dependent on the selected value of '" + Control.ID + "' for their rendering will not update in a callback. Turn callbacks off on '" + Control.ID + "'.");
}
}
}
-#endif
+