Author: igorz
Date: 2006-10-18 10:41:14 -0400 (Wed, 18 Oct 2006)
New Revision: 66789
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/DetailsViewRowCollectionTest.cs
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/DetailsViewTest.cs
Log:
2006-10-18 Igor Zelmanovich <[EMAIL PROTECTED]>
* DetailsView.cs: fixed: OnBubbleEvent works properly.
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2006-10-18 14:40:39 UTC (rev 66788)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2006-10-18 14:41:14 UTC (rev 66789)
@@ -1,5 +1,9 @@
2006-10-18 Igor Zelmanovich <[EMAIL PROTECTED]>
+ * DetailsView.cs: fixed: OnBubbleEvent works properly.
+
+2006-10-18 Igor Zelmanovich <[EMAIL PROTECTED]>
+
* DetailsView.cs: fixed: considers DataControlField.InsertVisible.
2006-10-18 Igor Zelmanovich <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
2006-10-18 14:40:39 UTC (rev 66788)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/DetailsView.cs
2006-10-18 14:41:14 UTC (rev 66789)
@@ -1251,6 +1251,8 @@
if (dataItem != null) {
if (CurrentMode == DetailsViewMode.Edit)
oldEditValues = new DataKey
(GetRowValues (false, true));
+ else
+ oldEditValues = new DataKey (new
OrderedDictionary ());
key = new DataKey (CreateRowDataKey (dataItem),
DataKeyNames);
}
}
@@ -1351,6 +1353,7 @@
if (args != null) {
OnItemCommand (args);
ProcessEvent (args.CommandName,
args.CommandArgument as string);
+ return true;
}
return base.OnBubbleEvent (source, e);
}
@@ -1384,13 +1387,15 @@
newIndex = PageCount - 1;
break;
case
DataControlCommands.NextPageCommandArgument:
- if (PageIndex < PageCount - 1) newIndex
= PageIndex + 1;
+ newIndex = PageIndex + 1;
break;
case
DataControlCommands.PreviousPageCommandArgument:
- if (PageIndex > 0) newIndex = PageIndex
- 1;
+ newIndex = PageIndex - 1;
break;
default:
- newIndex = int.Parse (param) - 1;
+ int paramIndex = 0;
+ int.TryParse (param, out paramIndex);
+ newIndex = paramIndex - 1;
break;
}
ShowPage (newIndex);
@@ -1494,9 +1499,12 @@
OnItemUpdating (args);
if (!args.Cancel) {
DataSourceView view = GetData ();
- if (view == null) throw new HttpException ("The
DataSourceView associated to data bound control was null");
- view.Update (currentEditRowKeys,
currentEditNewValues, currentEditOldValues, new DataSourceViewOperationCallback
(UpdateCallback));
- } else
+ if (view == null)
+ throw new HttpException ("The
DataSourceView associated to data bound control was null");
+ if (view.CanUpdate)
+ view.Update (currentEditRowKeys,
currentEditNewValues, currentEditOldValues, new DataSourceViewOperationCallback
(UpdateCallback));
+ }
+ else
EndRowEdit ();
}
@@ -1528,10 +1536,10 @@
OnItemInserting (args);
if (!args.Cancel) {
DataSourceView view = GetData ();
- if (view == null)
- return;
- view.Insert (currentEditNewValues, new
DataSourceViewOperationCallback (InsertCallback));
- } else
+ if (view != null && view.CanInsert)
+ view.Insert (currentEditNewValues, new
DataSourceViewOperationCallback (InsertCallback));
+ }
+ else
EndRowEdit ();
}
@@ -1559,7 +1567,7 @@
PageIndex --;
RequireBinding ();
DataSourceView view = GetData ();
- if (view != null)
+ if (view != null && view.CanDelete)
view.Delete (currentEditRowKeys,
currentEditNewValues, new DataSourceViewOperationCallback (DeleteCallback));
else {
DetailsViewDeletedEventArgs dargs = new
DetailsViewDeletedEventArgs (0, null, currentEditRowKeys, currentEditNewValues);
Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2006-10-18 14:40:39 UTC (rev 66788)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
2006-10-18 14:41:14 UTC (rev 66789)
@@ -1,5 +1,10 @@
2006-10-18 Igor Zelmanovich <[EMAIL PROTECTED]>
+ * DetailsViewTest.cs: removed NotWorking attributes
+ * DetailsViewRowCollectionTest.cs: removed NotWorking attributes
+
+2006-10-18 Igor Zelmanovich <[EMAIL PROTECTED]>
+
* DetailsViewTest.cs: added test
2006-10-17 Igor Zelmanovich <[EMAIL PROTECTED]>
Modified:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/DetailsViewRowCollectionTest.cs
===================================================================
---
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/DetailsViewRowCollectionTest.cs
2006-10-18 14:40:39 UTC (rev 66788)
+++
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/DetailsViewRowCollectionTest.cs
2006-10-18 14:41:14 UTC (rev 66789)
@@ -66,7 +66,6 @@
//properties
[Test]
- [Category ("NotWorking")] //SyncRootProperty - ArrayList
instead of DetailsViewRowCollection
public void DetailsViewRowCollection_Properties ()
{
DetailsViewRowCollection coll = new
DetailsViewRowCollection (myArr);
Modified:
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/DetailsViewTest.cs
===================================================================
---
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/DetailsViewTest.cs
2006-10-18 14:40:39 UTC (rev 66788)
+++
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/DetailsViewTest.cs
2006-10-18 14:41:14 UTC (rev 66789)
@@ -202,9 +202,9 @@
{
OnUnload (e);
}
- public void DoOnBubbleEvent (Object sender, EventArgs e)
+ public bool DoOnBubbleEvent (Object sender, EventArgs e)
{
- OnBubbleEvent (sender,e);
+ return OnBubbleEvent (sender, e);
}
public Object DoSaveControlState ()
@@ -1493,7 +1493,6 @@
}
[Test]
- [Category ("NotWorking")]
public void DetailsView_BubbleEvents ()
{
ResetEvents ();
@@ -1503,7 +1502,9 @@
Page page = new Page ();
Button bt = new Button ();
dv.AllowPaging = true;
- page.Controls.Add (dv);
+ dv.DataSource = myds;
+ page.Controls.Add (dv);
+ dv.DataBind ();
dv.ItemCommand += new DetailsViewCommandEventHandler
(dv_ItemCommand );
dv.ItemDeleted += new DetailsViewDeletedEventHandler
(dv_ItemDeleted );
//Delete
@@ -1511,7 +1512,7 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Delete", null));
Assert.AreEqual (false, itemCommand,
"BeforeDeleteCommandBubbleEvent");
Assert.AreEqual (false, itemDeleting,
"BeforeDeleteBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - Delete");
Assert.AreEqual (true, itemDeleting,
"AfterDeleteBubbleEvent");
Assert.AreEqual (true, itemCommand,
"AfterDeleteCommandBubbleEvent");
@@ -1522,7 +1523,7 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Insert", null));
Assert.AreEqual (false, itemCommand,
"BeforeInsertCommandBubbleEvent");
Assert.AreEqual (false, itemInserting,
"BeforeInsertBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - Insert");
Assert.AreEqual (true, itemCommand,
"AfterInsertCommandBubbleEvent");
Assert.AreEqual (true, itemInserting,
"AfterInsertBubbleEvent");
@@ -1533,7 +1534,7 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Update", null));
Assert.AreEqual (false, itemUpdating,
"BeforeUpdateEvent");
Assert.AreEqual (false, itemCommand,
"BeforeUpdateCommandEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - Update");
Assert.AreEqual (true, itemCommand,
"AfterUpdateCommandBubbleEvent");
Assert.AreEqual (true, itemUpdating,
"AfterUpdateBubbleEvent");
@@ -1543,7 +1544,7 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Cancel", null));
Assert.AreEqual (false, itemCommand,
"BeforeCancelCommandBubbleEvent");
Assert.AreEqual (false, modeChanging,
"BeforeCancelBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - Cancel");
Assert.AreEqual (true, itemCommand,
"AfterCancelCommandBubbleEvent");
Assert.AreEqual (true, modeChanging,
"AfterCancelBubbleEvent");
@@ -1553,7 +1554,7 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Edit", null));
Assert.AreEqual (false, itemCommand,
"BeforeEditCommandBubbleEvent");
Assert.AreEqual (false, modeChanging,
"BeforeEditBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - Edit");
Assert.AreEqual (true, itemCommand,
"AfterEditCommandBubbleEvent");
Assert.AreEqual (true, modeChanging,
"AfterEditBubbleEvent");
@@ -1563,7 +1564,7 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("New", null));
Assert.AreEqual (false, itemCommand,
"BeforeNewCommandBubbleEvent");
Assert.AreEqual (false, modeChanging,
"BeforeNewBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - New");
Assert.AreEqual (true, itemCommand,
"AfterNewCommandBubbleEvent");
Assert.AreEqual (true, modeChanging,
"AfterNewBubbleEvent");
@@ -1573,9 +1574,10 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Page", null));
Assert.AreEqual (false, itemCommand,
"BeforePageCommandBubbleEvent");
Assert.AreEqual (false, pageIndexChanging,
"BeforePageBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - Page Index default");
Assert.AreEqual (true, itemCommand,
"AfterPageCommandBubbleEvent");
Assert.AreEqual (true, pageIndexChanging,
"AfterPageBubbleEvent");
+ Assert.AreEqual (-1, newPageIndex, "PageIndex");
//Next Page
itemCommand = false;
@@ -1583,7 +1585,7 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Page", "Next"));
Assert.AreEqual (false, itemCommand,
"BeforeNextPageCommandBubbleEvent");
Assert.AreEqual (false, pageIndexChanging,
"BeforeNextPageBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - Next Page");
Assert.AreEqual (true, itemCommand,
"AfterNextPageCommandBubbleEvent");
Assert.AreEqual (true, pageIndexChanging,
"AfterNextPageBubbleEvent");
Assert.AreEqual (1, newPageIndex, "NextPageIndex");
@@ -1594,7 +1596,7 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Page", "Prev"));
Assert.AreEqual (false, itemCommand,
"BeforePrevPageCommandBubbleEvent");
Assert.AreEqual (false, pageIndexChanging,
"BeforePrevPageBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - Prev Page");
Assert.AreEqual (true, itemCommand,
"AfterPrevPageCommandBubbleEvent");
Assert.AreEqual (true, pageIndexChanging,
"AfterPrevPageBubbleEvent");
Assert.AreEqual (-1, newPageIndex, "PrevPageIndex");
@@ -1605,7 +1607,7 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Page", "First"));
Assert.AreEqual (false, itemCommand,
"BeforeFirstPageCommandBubbleEvent");
Assert.AreEqual (false, pageIndexChanging,
"BeforeFirstPageBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - First Page");
Assert.AreEqual (true, itemCommand,
"AfterFirstPageCommandBubbleEvent");
Assert.AreEqual (true, pageIndexChanging,
"AfterFirstPageBubbleEvent");
Assert.AreEqual (0, newPageIndex, "FirstPageIndex");
@@ -1616,10 +1618,10 @@
com = new DetailsViewCommandEventArgs (bt, new
CommandEventArgs ("Page", "Last"));
Assert.AreEqual (false, itemCommand,
"BeforeLastPageCommandBubbleEvent");
Assert.AreEqual (false, pageIndexChanging,
"BeforeLastPageBubbleEvent");
- dv.DoOnBubbleEvent (bt, com);
+ Assert.IsTrue (dv.DoOnBubbleEvent (bt, com),
"OnBubbleEvent - Last Page");
Assert.AreEqual (true, itemCommand,
"AfterLastPageCommandBubbleEvent");
Assert.AreEqual (true, pageIndexChanging,
"AfterLastPageBubbleEvent");
- Assert.AreEqual (-1, newPageIndex, "FirstPageIndex");
+ Assert.AreEqual (5, newPageIndex, "FirstPageIndex");
}
@@ -1725,6 +1727,7 @@
{
pageIndexChanging = true;
newPageIndex = e.NewPageIndex;
+ e.NewPageIndex = -1;
}
void dv_PageIndexChanged (object sender, EventArgs e)
@@ -2045,3 +2048,4 @@
}
#endif
+
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches