Author: kostat
Date: 2006-07-03 09:56:24 -0400 (Mon, 03 Jul 2006)
New Revision: 62201
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs
trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
Log:
* DataBoundControl.cs: implement MarkAsDataBound and consider it while
setting RequiresDataBinding in OnLoad event.
* GridView.cs: DataBind rows before other control can access the data.
* BoundField.cs: add unique ID to control for postback parameters.
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs
2006-07-03 13:44:22 UTC (rev 62200)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/BoundField.cs
2006-07-03 13:56:24 UTC (rev 62201)
@@ -174,6 +174,7 @@
bool editable = (rowState & (DataControlRowState.Edit |
DataControlRowState.Insert)) != 0;
if (editable && !ReadOnly) {
TextBox box = new TextBox ();
+ box.ID = cell.ClientID;
cell.Controls.Add (box);
}
}
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2006-07-03 13:44:22 UTC (rev 62200)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2006-07-03 13:56:24 UTC (rev 62201)
@@ -1,3 +1,10 @@
+2006-07-03 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * DataBoundControl.cs: implement MarkAsDataBound and consider it while
+ setting RequiresDataBinding in OnLoad event.
+ * GridView.cs: DataBind rows before other control can access the data.
+ * BoundField.cs: add unique ID to control for postback parameters.
+
2006-07-03 Konstantin Triger <[EMAIL PROTECTED]>
* WebControl.cs: fix typo in EnableTheming.
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs
2006-07-03 13:44:22 UTC (rev 62200)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DataBoundControl.cs
2006-07-03 13:56:24 UTC (rev 62201)
@@ -147,7 +147,7 @@
protected internal override void OnLoad (EventArgs e)
{
- if (IsBoundUsingDataSourceID && (!Page.IsPostBack ||
!EnableViewState))
+ if (!Page.IsPostBack || (IsViewStateEnabled &&
!IsDataBound))
RequiresDataBinding = true;
base.OnLoad(e);
@@ -181,12 +181,22 @@
}
}
+ //
+ // See DataBoundControl.MarkAsDataBound msdn doc for the code
example
+ //
protected override void PerformSelect ()
{
- OnDataBinding (EventArgs.Empty);
+ // Call OnDataBinding here if bound to a data source
using the
+ // DataSource property (instead of a DataSourceID),
because the
+ // databinding statement is evaluated before the call
to GetData.
+ if (!IsBoundUsingDataSourceID)
+ OnDataBinding (EventArgs.Empty);
+
DataSourceView view = GetData ();
- if (view != null)
+ if (view != null) {
view.Select (SelectArguments, new
DataSourceViewSelectCallback (OnSelect));
+ MarkAsDataBound ();
+ }
}
void OnSelect (IEnumerable data)
@@ -208,10 +218,19 @@
}
}
- [MonoTODO]
+ bool IsDataBound {
+ get {
+ object dataBound = ViewState ["DataBound"];
+ return dataBound != null ? (bool) dataBound :
false;
+ }
+ set {
+ ViewState ["DataBound"] = value;
+ }
+ }
+
protected void MarkAsDataBound ()
{
- throw new NotImplementedException ();
+ IsDataBound = true;
}
}
}
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
2006-07-03 13:44:22 UTC (rev 62200)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
2006-07-03 13:56:24 UTC (rev 62201)
@@ -1155,7 +1155,7 @@
table.Rows.Add (row);
InitializeRow (row, fields);
if (dataBinding) {
- //
row.DataBind ();
+ row.DataBind ();
OnRowDataBound (new
GridViewRowEventArgs (row));
if (EditIndex == row.RowIndex)
oldEditValues = new DataKey
(GetRowValues (row, false, true));
@@ -1186,9 +1186,6 @@
rows = new GridViewRowCollection (list);
keys = new DataKeyArray (keyList);
-
- if (dataBinding)
- DataBind (false);
return dataSource.DataSourceCount;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches