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:
-rw-r--r--mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ChangeLog5
-rw-r--r--mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListView.cs31
-rw-r--r--mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ChangeLog4
-rw-r--r--mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ListViewTest.cs130
4 files changed, 160 insertions, 10 deletions
diff --git a/mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ChangeLog
index 32e1a8d9bce..86495a1914e 100644
--- a/mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ChangeLog
+++ b/mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-20 Marek Habersack <mhabersack@novell.com>
+
+ * ListView.cs: implemented the EditItem property.
+ Use ConvertEmptyStringToNull in ExtractItemValues.
+
2008-11-19 Marek Habersack <mhabersack@novell.com>
* ListView.cs: added paremeter checks to AddControlToContainer.
diff --git a/mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListView.cs b/mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListView.cs
index 3a196d06a3d..784217d2f03 100644
--- a/mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListView.cs
+++ b/mcs/class/System.Web.Extensions/System.Web.UI.WebControls/ListView.cs
@@ -396,8 +396,12 @@ namespace System.Web.UI.WebControls
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public virtual ListViewItem EditItem {
- get;
- private set;
+ get {
+ IList <ListViewDataItem> items = Items;
+ if (_editIndex >= 0 && _editIndex < items.Count)
+ return items [_editIndex];
+ return null;
+ }
}
[TemplateContainer (typeof (System.Web.UI.WebControls.ListViewDataItem), BindingDirection.TwoWay)]
@@ -430,6 +434,7 @@ namespace System.Web.UI.WebControls
[WebCategory ("Behavior")]
[DefaultValue (false)]
+ [MonoTODO ("Figure out where it is used and what's the effect of setting it to true.")]
public virtual bool EnableModelValidation {
get {
object o = ViewState ["EnableModelValidation"];
@@ -1251,9 +1256,8 @@ namespace System.Web.UI.WebControls
bt = (IBindableTemplate) _alternatingItemTemplate;
else
bt = (IBindableTemplate) _itemTemplate;
- } else if (_insertItemTemplate != null && item.ItemType == ListViewItemType.InsertItem) {
+ } else if (_insertItemTemplate != null && item.ItemType == ListViewItemType.InsertItem)
bt = (IBindableTemplate) _insertItemTemplate;
- }
if (bt == null)
return;
@@ -1264,11 +1268,22 @@ namespace System.Web.UI.WebControls
string[] keyNames = includePrimaryKey ? null : DataKeyNames;
bool haveKeyNames = keyNames != null && keyNames.Length > 0;
- object key;
+ object key, value;
+ string s;
+ bool convertEmptyStringToNull = ConvertEmptyStringToNull;
+
foreach (DictionaryEntry de in values) {
key = de.Key;
- if (includePrimaryKey || (haveKeyNames && Array.IndexOf (keyNames, key) != -1))
- itemValues [key] = de.Value;
+ if (includePrimaryKey || (haveKeyNames && Array.IndexOf (keyNames, key) != -1)) {
+ value = de.Value;
+ if (convertEmptyStringToNull) {
+ s = value as string;
+ if (s != null && s.Length == 0)
+ value = null;
+ }
+
+ itemValues [key] = value;
+ }
}
}
@@ -1639,7 +1654,7 @@ namespace System.Web.UI.WebControls
{
var args = new ListViewDeletedEventArgs (affectedRows, exception, _currentDeletingItemKeys, _currentDeletingItemValues);
OnItemDeleted (args);
-
+
EditIndex = -1;
RequiresDataBinding = true;
diff --git a/mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ChangeLog
index 023e9be8208..3f43dc5151e 100644
--- a/mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ChangeLog
+++ b/mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ChangeLog
@@ -1,3 +1,7 @@
+2008-11-20 Marek Habersack <mhabersack@novell.com>
+
+ * ListViewTest.cs: added tests for several properties.
+
2008-11-19 Marek Habersack <mhabersack@novell.com>
* EventRecorder.cs: class is now serializable.
diff --git a/mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ListViewTest.cs b/mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ListViewTest.cs
index 548e52f4382..3323c32cedd 100644
--- a/mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ListViewTest.cs
+++ b/mcs/class/System.Web.Extensions/Test/System.Web.UI.WebControls/ListViewTest.cs
@@ -32,6 +32,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
+using System.Drawing;
using System.Reflection;
using System.Web.UI;
using System.Web.UI.HtmlControls;
@@ -219,6 +220,11 @@ namespace Tests.System.Web.UI.WebControls
SetPageProperties (startRowIndex, maximumRows, databind);
}
+ public bool GetRequiresDataBinding ()
+ {
+ return RequiresDataBinding;
+ }
+
public int GetMaximumRowsProperty ()
{
return MaximumRows;
@@ -1032,7 +1038,7 @@ namespace Tests.System.Web.UI.WebControls
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void ListView_SetPageProperties_Parameters1 ()
{
- ListViewPoker lvp = new ListViewPoker ();
+ var lvp = new ListViewPoker ();
lvp.DoSetPageProperties (-1, 1, false);
}
@@ -1040,9 +1046,129 @@ namespace Tests.System.Web.UI.WebControls
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void ListView_SetPageProperties_Parameters2 ()
{
- ListViewPoker lvp = new ListViewPoker ();
+ var lvp = new ListViewPoker ();
lvp.DoSetPageProperties (0, 0, false);
}
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_AccessKey ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.AccessKey = String.Empty;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_BackColor ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.BackColor = Color.White;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_BorderColor ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.BorderColor = Color.White;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_BorderStyle ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.BorderStyle = BorderStyle.NotSet;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_BorderWidth ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.BorderWidth = Unit.Empty;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_CssClass ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.CssClass = String.Empty;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_Font ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.Font.Bold = true;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_ForeColor ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.ForeColor = Color.White;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_Height ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.Height = Unit.Empty;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_ToolTip ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.ToolTip = String.Empty;
+ }
+
+ [Test]
+ [ExpectedException (typeof (NotSupportedException))]
+ public void ListView_Width ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.Width = Unit.Empty;
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void ListView_EditIndex_SetInvalid ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.EditIndex = -2;
+ }
+
+ [Test]
+ public void ListView_EditIndex_Set ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.EditIndex = 0;
+ Assert.AreEqual (0, lvp.EditIndex, "#A1");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void ListView_SelectedIndex_SetInvalid ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.SelectedIndex = -2;
+ }
+
+ [Test]
+ public void ListView_SelectedIndex_Set ()
+ {
+ var lvp = new ListViewPoker ();
+ lvp.SelectedIndex = 0;
+ Assert.AreEqual (0, lvp.SelectedIndex, "#A1");
+ }
[Test]
public void ListView_Edit ()