Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs')
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs304
1 files changed, 149 insertions, 155 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
index ca5e4db4296..570bb6d3806 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs
@@ -40,13 +40,12 @@ using System.Reflection;
namespace System.Web.UI.WebControls
{
- [SupportsEventValidation]
[DesignerAttribute ("System.Web.UI.Design.WebControls.FormViewDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
[ControlValuePropertyAttribute ("SelectedValue")]
[DefaultEventAttribute ("PageIndexChanging")]
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public class FormView: CompositeDataBoundControl, IDataItemContainer, INamingContainer, IPostBackEventHandler, IPostBackContainer
+ public class FormView: CompositeDataBoundControl, IDataItemContainer, INamingContainer
{
object dataItem;
@@ -268,7 +267,7 @@ namespace System.Web.UI.WebControls
[WebCategoryAttribute ("Paging")]
[DefaultValueAttribute (false)]
- public virtual bool AllowPaging {
+ public bool AllowPaging {
get {
object ob = ViewState ["AllowPaging"];
if (ob != null) return (bool) ob;
@@ -308,7 +307,7 @@ namespace System.Web.UI.WebControls
[WebCategoryAttribute ("Accessibility")]
[DefaultValueAttribute ("")]
[LocalizableAttribute (true)]
- public virtual string Caption {
+ public string Caption {
get {
object ob = ViewState ["Caption"];
if (ob != null) return (string) ob;
@@ -365,16 +364,16 @@ namespace System.Web.UI.WebControls
}
}
- [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
- [BrowsableAttribute (false)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
public FormViewMode CurrentMode {
get {
return currentMode;
}
}
- [DefaultValueAttribute (FormViewMode.ReadOnly)]
- [WebCategoryAttribute ("Behavior")]
+ [DefaultValueAttribute (FormViewMode.ReadOnly)]
+ [WebCategoryAttribute ("Behavior")]
public virtual FormViewMode DefaultMode {
get {
object o = ViewState ["DefaultMode"];
@@ -416,18 +415,18 @@ namespace System.Web.UI.WebControls
[DefaultValue (null)]
[TemplateContainer (typeof(FormView), BindingDirection.TwoWay)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [Browsable (false)]
- public virtual ITemplate EditItemTemplate {
+ [Browsable (false)]
+ public ITemplate EditItemTemplate {
get { return editItemTemplate; }
set { editItemTemplate = value; RequireBinding (); }
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- [DefaultValueAttribute (null)]
- public TableItemStyle EditRowStyle {
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle EditRowStyle {
get {
if (editRowStyle == null) {
editRowStyle = new TableItemStyle ();
@@ -438,12 +437,12 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- [DefaultValueAttribute (null)]
- public TableItemStyle EmptyDataRowStyle {
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle EmptyDataRowStyle {
get {
if (emptyDataRowStyle == null) {
emptyDataRowStyle = new TableItemStyle ();
@@ -457,8 +456,8 @@ namespace System.Web.UI.WebControls
[DefaultValue (null)]
[TemplateContainer (typeof(FormView), BindingDirection.OneWay)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [Browsable (false)]
- public virtual ITemplate EmptyDataTemplate {
+ [Browsable (false)]
+ public ITemplate EmptyDataTemplate {
get { return emptyDataTemplate; }
set { emptyDataTemplate = value; RequireBinding (); }
}
@@ -490,16 +489,16 @@ namespace System.Web.UI.WebControls
[DefaultValue (null)]
[TemplateContainer (typeof(FormView), BindingDirection.OneWay)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [Browsable (false)]
- public virtual ITemplate FooterTemplate {
+ [Browsable (false)]
+ public ITemplate FooterTemplate {
get { return footerTemplate; }
set { footerTemplate = value; RequireBinding (); }
}
- [LocalizableAttribute (true)]
- [WebCategoryAttribute ("Appearance")]
- [DefaultValueAttribute ("")]
- public virtual string FooterText {
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public string FooterText {
get {
object ob = ViewState ["FooterText"];
if (ob != null) return (string) ob;
@@ -511,12 +510,12 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DefaultValue (null)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle FooterStyle {
+ public virtual TableItemStyle FooterStyle {
get {
if (footerStyle == null) {
footerStyle = new TableItemStyle ();
@@ -549,12 +548,12 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DefaultValue (null)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle HeaderStyle {
+ public virtual TableItemStyle HeaderStyle {
get {
if (headerStyle == null) {
headerStyle = new TableItemStyle ();
@@ -568,16 +567,16 @@ namespace System.Web.UI.WebControls
[DefaultValue (null)]
[TemplateContainer (typeof(FormView), BindingDirection.OneWay)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [Browsable (false)]
- public virtual ITemplate HeaderTemplate {
+ [Browsable (false)]
+ public ITemplate HeaderTemplate {
get { return headerTemplate; }
set { headerTemplate = value; RequireBinding (); }
}
- [LocalizableAttribute (true)]
- [WebCategoryAttribute ("Appearance")]
- [DefaultValueAttribute ("")]
- public virtual string HeaderText {
+ [LocalizableAttribute (true)]
+ [WebCategoryAttribute ("Appearance")]
+ [DefaultValueAttribute ("")]
+ public string HeaderText {
get {
object ob = ViewState ["HeaderText"];
if (ob != null) return (string) ob;
@@ -606,18 +605,18 @@ namespace System.Web.UI.WebControls
[DefaultValue (null)]
[TemplateContainer (typeof(FormView), BindingDirection.TwoWay)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [Browsable (false)]
- public virtual ITemplate InsertItemTemplate {
+ [Browsable (false)]
+ public ITemplate InsertItemTemplate {
get { return insertItemTemplate; }
set { insertItemTemplate = value; RequireBinding (); }
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- [DefaultValueAttribute (null)]
- public TableItemStyle InsertRowStyle {
+ [DefaultValueAttribute (null)]
+ public virtual TableItemStyle InsertRowStyle {
get {
if (insertRowStyle == null) {
insertRowStyle = new TableItemStyle ();
@@ -631,15 +630,15 @@ namespace System.Web.UI.WebControls
[DefaultValue (null)]
[TemplateContainer (typeof(FormView), BindingDirection.TwoWay)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [Browsable (false)]
- public virtual ITemplate ItemTemplate {
+ [Browsable (false)]
+ public ITemplate ItemTemplate {
get { return itemTemplate; }
set { itemTemplate = value; RequireBinding (); }
}
[BrowsableAttribute (false)]
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
- public virtual int PageCount {
+ public int PageCount {
get {
if (pageCount != -1) return pageCount;
EnsureDataBound ();
@@ -648,9 +647,9 @@ namespace System.Web.UI.WebControls
}
[WebCategoryAttribute ("Paging")]
- [BindableAttribute (true, BindingDirection.OneWay)]
+ [BindableAttribute (true, BindingDirection.OneWay)]
[DefaultValueAttribute (0)]
- public virtual int PageIndex {
+ public int PageIndex {
get {
return pageIndex;
}
@@ -664,7 +663,7 @@ namespace System.Web.UI.WebControls
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Content)]
[NotifyParentPropertyAttribute (true)]
[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
- public virtual PagerSettings PagerSettings {
+ public PagerSettings PagerSettings {
get {
if (pagerSettings == null) {
pagerSettings = new PagerSettings (this);
@@ -675,11 +674,11 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle PagerStyle {
+ public virtual TableItemStyle PagerStyle {
get {
if (pagerStyle == null) {
pagerStyle = new TableItemStyle ();
@@ -695,27 +694,27 @@ namespace System.Web.UI.WebControls
/* DataControlPagerCell isnt specified in the docs */
//[TemplateContainer (typeof(DataControlPagerCell), BindingDirection.OneWay)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [Browsable (false)]
- public virtual ITemplate PagerTemplate {
+ [Browsable (false)]
+ public ITemplate PagerTemplate {
get { return pagerTemplate; }
set { pagerTemplate = value; RequireBinding (); }
}
- [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
- [BrowsableAttribute (false)]
- public virtual FormViewRow Row {
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [BrowsableAttribute (false)]
+ public FormViewRow Row {
get {
EnsureDataBound ();
return itemRow;
}
}
-
- [WebCategoryAttribute ("Styles")]
+
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
[DefaultValue (null)]
- public TableItemStyle RowStyle {
+ public virtual TableItemStyle RowStyle {
get {
if (rowStyle == null) {
rowStyle = new TableItemStyle ();
@@ -726,9 +725,9 @@ namespace System.Web.UI.WebControls
}
}
- [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+ [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
[BrowsableAttribute (false)]
- public object SelectedValue {
+ public virtual object SelectedValue {
get { return DataKey.Value; }
}
@@ -743,7 +742,7 @@ namespace System.Web.UI.WebControls
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
[BrowsableAttribute (false)]
- public virtual object DataItem {
+ public object DataItem {
get {
EnsureDataBound ();
return dataItem;
@@ -758,7 +757,7 @@ namespace System.Web.UI.WebControls
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
[BrowsableAttribute (false)]
- public virtual int DataItemIndex {
+ public int DataItemIndex {
get { return PageIndex; }
}
@@ -1069,6 +1068,12 @@ namespace System.Web.UI.WebControls
base.OnInit (e);
}
+ protected override void OnDataSourceViewChanged (object sender, EventArgs e)
+ {
+ base.OnDataSourceViewChanged (sender, e);
+ RequireBinding ();
+ }
+
protected override bool OnBubbleEvent (object source, EventArgs e)
{
FormViewCommandEventArgs args = e as FormViewCommandEventArgs;
@@ -1079,11 +1084,7 @@ namespace System.Web.UI.WebControls
return base.OnBubbleEvent (source, e);
}
- void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
- {
- RaisePostBackEvent (eventArgument);
- }
-
+ // This is prolly obsolete
protected virtual void RaisePostBackEvent (string eventArgument)
{
int i = eventArgument.IndexOf ('$');
@@ -1097,69 +1098,69 @@ namespace System.Web.UI.WebControls
{
switch (eventName)
{
- case DataControlCommands.PageCommandName:
- int newIndex = -1;
- switch (param) {
+ case DataControlCommands.PageCommandName:
+ int newIndex = -1;
+ switch (param) {
+ case DataControlCommands.FirstPageCommandArgument:
+ newIndex = 0;
+ break;
+ case DataControlCommands.LastPageCommandArgument:
+ newIndex = PageCount - 1;
+ break;
+ case DataControlCommands.NextPageCommandArgument:
+ if (PageIndex < PageCount - 1) newIndex = PageIndex + 1;
+ break;
+ case DataControlCommands.PreviousPageCommandArgument:
+ if (PageIndex > 0) newIndex = PageIndex - 1;
+ break;
+ default:
+ newIndex = int.Parse (param) - 1;
+ break;
+ }
+ ShowPage (newIndex);
+ break;
+
case DataControlCommands.FirstPageCommandArgument:
- newIndex = 0;
+ ShowPage (0);
break;
+
case DataControlCommands.LastPageCommandArgument:
- newIndex = PageCount - 1;
+ ShowPage (PageCount - 1);
break;
+
case DataControlCommands.NextPageCommandArgument:
- if (PageIndex < PageCount - 1) newIndex = PageIndex + 1;
+ if (PageIndex < PageCount - 1)
+ ShowPage (PageIndex + 1);
break;
+
case DataControlCommands.PreviousPageCommandArgument:
- if (PageIndex > 0) newIndex = PageIndex - 1;
- break;
- default:
- newIndex = int.Parse (param) - 1;
+ if (PageIndex > 0)
+ ShowPage (PageIndex - 1);
break;
- }
- ShowPage (newIndex);
- break;
-
- case DataControlCommands.FirstPageCommandArgument:
- ShowPage (0);
- break;
-
- case DataControlCommands.LastPageCommandArgument:
- ShowPage (PageCount - 1);
- break;
- case DataControlCommands.NextPageCommandArgument:
- if (PageIndex < PageCount - 1)
- ShowPage (PageIndex + 1);
- break;
-
- case DataControlCommands.PreviousPageCommandArgument:
- if (PageIndex > 0)
- ShowPage (PageIndex - 1);
- break;
-
- case DataControlCommands.EditCommandName:
- ChangeMode (FormViewMode.Edit);
- break;
+ case DataControlCommands.EditCommandName:
+ ChangeMode (FormViewMode.Edit);
+ break;
- case DataControlCommands.NewCommandName:
- ChangeMode (FormViewMode.Insert);
- break;
+ case DataControlCommands.NewCommandName:
+ ChangeMode (FormViewMode.Insert);
+ break;
- case DataControlCommands.UpdateCommandName:
- UpdateItem (param, true);
- break;
+ case DataControlCommands.UpdateCommandName:
+ UpdateItem (param, true);
+ break;
- case DataControlCommands.CancelCommandName:
- CancelEdit ();
- break;
+ case DataControlCommands.CancelCommandName:
+ CancelEdit ();
+ break;
- case DataControlCommands.DeleteCommandName:
- DeleteItem ();
- break;
+ case DataControlCommands.DeleteCommandName:
+ DeleteItem ();
+ break;
- case DataControlCommands.InsertCommandName:
- InsertItem (true);
- break;
+ case DataControlCommands.InsertCommandName:
+ InsertItem (true);
+ break;
}
}
@@ -1220,7 +1221,7 @@ namespace System.Web.UI.WebControls
EndRowEdit ();
}
- bool UpdateCallback (int recordsAffected, Exception exception)
+ bool UpdateCallback (int recordsAffected, Exception exception)
{
FormViewUpdatedEventArgs dargs = new FormViewUpdatedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
OnItemUpdated (dargs);
@@ -1254,7 +1255,7 @@ namespace System.Web.UI.WebControls
EndRowEdit ();
}
- bool InsertCallback (int recordsAffected, Exception exception)
+ bool InsertCallback (int recordsAffected, Exception exception)
{
FormViewInsertedEventArgs dargs = new FormViewInsertedEventArgs (recordsAffected, exception, currentEditNewValues);
OnItemInserted (dargs);
@@ -1265,7 +1266,7 @@ namespace System.Web.UI.WebControls
return dargs.ExceptionHandled;
}
- public virtual void DeleteItem ()
+ public void DeleteItem ()
{
currentEditRowKeys = DataKey.Values;
currentEditNewValues = GetRowValues (true);
@@ -1289,7 +1290,7 @@ namespace System.Web.UI.WebControls
}
}
- bool DeleteCallback (int recordsAffected, Exception exception)
+ bool DeleteCallback (int recordsAffected, Exception exception)
{
FormViewDeletedEventArgs dargs = new FormViewDeletedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditNewValues);
OnItemDeleted (dargs);
@@ -1321,7 +1322,7 @@ namespace System.Web.UI.WebControls
object bstate = base.SaveControlState ();
return new object[] {
bstate, pageIndex, pageCount, currentMode
- };
+ };
}
protected override void TrackViewState()
@@ -1388,21 +1389,21 @@ namespace System.Web.UI.WebControls
protected internal override void Render (HtmlTextWriter writer)
{
switch (GridLines) {
- case GridLines.Horizontal:
- writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows");
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
- break;
- case GridLines.Vertical:
- writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols");
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
- break;
- case GridLines.Both:
- writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all");
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
- break;
- default:
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
- break;
+ case GridLines.Horizontal:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Vertical:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Both:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ default:
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ break;
}
writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
@@ -1412,21 +1413,21 @@ namespace System.Web.UI.WebControls
foreach (FormViewRow row in table.Rows)
{
switch (row.RowType) {
- case DataControlRowType.Header:
- if (headerStyle != null)headerStyle.AddAttributesToRender (writer, row);
- break;
- case DataControlRowType.Footer:
- if (footerStyle != null) footerStyle.AddAttributesToRender (writer, row);
- break;
- case DataControlRowType.Pager:
- if (pagerStyle != null) pagerStyle.AddAttributesToRender (writer, row);
- break;
- case DataControlRowType.EmptyDataRow:
- if (emptyDataRowStyle != null) emptyDataRowStyle.AddAttributesToRender (writer, row);
- break;
- default:
- if (rowStyle != null) rowStyle.AddAttributesToRender (writer, row);
- break;
+ case DataControlRowType.Header:
+ if (headerStyle != null)headerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Footer:
+ if (footerStyle != null) footerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Pager:
+ if (pagerStyle != null) pagerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.EmptyDataRow:
+ if (emptyDataRowStyle != null) emptyDataRowStyle.AddAttributesToRender (writer, row);
+ break;
+ default:
+ if (rowStyle != null) rowStyle.AddAttributesToRender (writer, row);
+ break;
}
if ((row.RowState & DataControlRowState.Edit) != 0 && editRowStyle != null)
@@ -1443,13 +1444,6 @@ namespace System.Web.UI.WebControls
}
table.RenderEndTag (writer);
}
-
- [MonoTODO]
- PostBackOptions IPostBackContainer.GetPostBackOptions (IButtonControl control)
- {
- throw new NotImplementedException ();
- }
-
}
}