Files
mono/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
T
Jackson Harper f21c03b531 2005-07-18 Jackson Harper <[email protected]>
* HtmlInputHiddenTest.cs: New test.

2005-07-14  Jackson Harper  <[email protected]>

	* HtmlInputButton.cs: New tests for HtmlInputButton.

2005-07-14  Jackson Harper  <[email protected]>

	* HtmlButtonTest.cs: New tests for HtmlButton.

2005-08-08  Jackson Harper  <[email protected]>

	* PagedDataSourceTest.cs: Tests for creating enumerators when
	paging is not enabled.

2005-08-05  Jackson Harper  <[email protected]>

	* PagedDataSourceTest.cs: Tests for PageCount.

2005-08-02  Jackson Harper  <[email protected]>

	* BoundColumnTest.cs: Start of tests for the BoundColumn class.
	
2005-08-01  Jackson Harper  <[email protected]>

	* TableStyleTest.cs: Check that items copied set the styles flags.

2005-08-01  Jackson Harper  <[email protected]>

	* PagedDataSourceTest.cs: Test the enumerators a little.

2005-07-28  Jackson Harper  <[email protected]>

	* EditCommandColumnTest.cs: Make the DataGridTest nested so my
	top secret DataGrid tests will still compile.

2005-07-25  Jackson Harper  <[email protected]>

	* DataGridTest.cs: More tests for the pager.

2005-07-22  Jackson Harper  <[email protected]>

	* DataGridTest.cs: Basic test for InitializePager.

2005-07-21  Jackson Harper  <[email protected]>

	* DataGridTest.cs: Test the order the events are invoked in when
	creating the control hierarchy.

2005-07-21  Jackson Harper  <[email protected]>

	* PagedDataSourceTest.cs: Test to see what happens when we get a
	non ITypedList.

2005-07-20  Jackson Harper  <[email protected]>
2005-07-20  Jackson Harper  <[email protected]>

	* DataGridTest.cs: Make sure we get back a proper columns
	collection.

2005-07-20  Jackson Harper  <[email protected]>

	* DataGridTest.cs: The columns collection cached from the
	CreateColumnSet is stored in the view state.

2005-07-20  Jackson Harper  <[email protected]>

	* DataGridTest.cs: Test generating column names with/without
	enabling useDataSource.

2005-07-20  Jackson Harper  <[email protected]>

	* DataGridTest.cs: Check the properties of newly created
	BoundColumns.

2005-07-19  Jackson Harper  <[email protected]>

	* PagedDataSource.cs: New unit test for GetItemProperties.

2005-07-19  Jackson Harper  <[email protected]>

	* DataGridTest.cs: New tests for creating column sets.

2005-07-19  Jackson Harper  <[email protected]>

	* CheckBoxListTest.cs: New tests for FindControl.

2005-07-19  Jackson Harper  <[email protected]>

	* DataGridTest.cs: New test for viewstate saving.

2005-07-19  Jackson Harper  <[email protected]>

	* DataGridTest.cs: Bubble tests for Page command. Tests for bad
	Page command bubble event args.

2005-07-19  Jackson Harper  <[email protected]>

	* DataGridTest.cs: Select can also be bubbled.

2005-07-19  Jackson Harper  <[email protected]>

	* DataGridTest.cs: Tests for the BubbleEvent.

2005-07-19  Jackson Harper  <[email protected]>

	* DataGridTest.cs: New tests. Just does properties and events for
	the most part.

2005-07-15  Jackson Harper  <[email protected]>

	* CheckBoxListTest.cs: New tests for FindControl.

2005-07-15  Jackson Harper  <[email protected]>

	* WebControlTest.cs: New test to make sure NamingContainers are
	honoured when rendering client ids.

2005-07-15  Jackson Harper  <[email protected]>

	* CheckBoxListTest.cs: More tests for the IRepeatInfoUser stuff
	and for rendering.

2005-07-14  Jackson Harper  <[email protected]>

	* CheckBoxListTest.cs: Rendering tests.

2005-07-14  Jackson Harper  <[email protected]>

	* CheckBoxListTest.cs: Fix the exception types thrown for bad
	enums. Mark as NotWorking as this doesn't work with the old
	CheckBoxList class anymore.

2005-07-14  Jackson Harper  <[email protected]>

	* CheckBoxListTest.cs: Add some rendering tests. These aren't
	fully working yet so they are in the NotWorking category.

2005-07-14  Jackson Harper  <[email protected]>

	* CheckBoxListTest.cs: This has the potential to be a beautiful
	test.

2005-07-14  Jackson Harper  <[email protected]>

	* ListControlTest.cs: New test for the viewstate and item
	selection.

2005-07-13  Jackson Harper  <[email protected]>

	* ListControlTest.cs: New tests for the ListControl.

2005-07-13  Jackson Harper  <[email protected]>

	* ListBoxTest.cs: Exception is thrown (by ListControl). Dont run
	the BadBorderStyle test as this fails in ListControls.

2005-07-12  Jackson Harper  <[email protected]>

	* ListBoxTest.cs: Some simple tests for the ListBox control.
	
2005-07-08  Jackson Harper  <[email protected]>

	* LiteralTest.cs: new test.
	* MonthCalendarEventArgsTest.cs: new test.

2005-07-08  Jackson Harper  <[email protected]>

	* AdCreatedEventArgsTest.cs: Added test.

2005-07-08  Jackson Harper  <[email protected]>

	* ToolbarDataAttributeTest.cs: New test.

2005-07-07  Jackson Harper  <[email protected]>

	* PropertyConverterTest.cs: New tests.

2005-08-15  Jackson Harper  <[email protected]>

	* CacheItemPriority.cs:
	* CacheItemRemovedCallback.cs:
	* CacheItemRemovedReason.cs: New implementations.

2005-08-26  Jackson Harper  <[email protected]>

	* HttpResponseStream.cs: Use GetBuffer so the memory isn't
	duplicated.

2005-08-26  Jackson Harper  <[email protected]>

	* HttpResponse.cs: Send the cached headers if this is a cached
	response. Save the headers, date header, and page data. Fix a typo.
	* HttpResponseStream.cs: Add new accesor to get a byte [] of the
	page data.

2005-08-15  Jackson Harper  <[email protected]>

	* ApplicationShutdownReason.cs: make build

2005-07-18  Jackson Harper  <[email protected]>

	* HtmlInputHidden.cs: Use Events Add/Remove. Add DefaultEvent
	attribute.

2005-07-15  Jackson Harper  <[email protected]>

	* HtmlInputImage.cs: Use Events Add/Remove. Remove uneeded
	constant. Update fetching from viewstate code to use new
	convenience method.

2005-07-15  Jackson Harper  <[email protected]>

	* HtmlInputButton.cs: Add DefaultEventAttribute.

2005-07-14  Jackson Harper  <[email protected]>

	* HtmlInputButton.cs: Use Events Add/Remove. Remove Causesvalidation
	string constant. Use new method for accessing ViewState
	data. Don't remove value from the view state if it is the default.

2005-07-14  Jackson Harper  <[email protected]>

	* HtmlButton.cs: Use Events Add/Remove. Remove Causesvalidation
	string constant. Use new method for accessing ViewState
	data. Don't remove value from the view state if it is the default.
	
2005-07-14  Jackson Harper  <[email protected]>

	* HtmlInputControl.cs: Use ClientID for input controls name.

2005-07-07  Jackson Harper  <[email protected]>

	* HtmlInputImage.cs: New implementation.

2005-07-07  Jackson Harper  <[email protected]>

	* HtmlInputHidden.cs: New implementation.

2005-07-07  Jackson Harper  <[email protected]>

	* HtmlAnchor.cs: Call base OnPreRender from override.

2005-07-07  Jackson Harper  <[email protected]>

	* HtmlInputButton.cs: New implementation.

2005-07-06  Jackson Harper  <[email protected]>

	* HtmlButton.cs: New implementation.

2005-07-13  Jackson Harper  <[email protected]>

	* PropertyConverter.cs: No public constructors.

2005-07-08  Jackson Harper  <[email protected]>

	* ToolbarDataAttribute.cs: New implementation.

2005-07-07  Jackson Harper  <[email protected]>

	* PropertyConverter.cs: New implementation.

2005-08-25  Jackson Harper  <[email protected]>

	* DataGrid.cs: Disable the pager row if there no paging enabled
	or available.

2005-08-25  Jackson Harper  <[email protected]>

	* DataGrid.cs: The number of pages set in the pager is specified
	by PageButtonCount.

2005-08-22  Jackson Harper  <[email protected]>

	* DataGrid.cs (CreateControlHierarchy): Clear out the old pager after creating the
	controls.
	(InitializeNumericPager): Now that the pager actually renders
	properly I can see that I was computing it incorrectly.

2005-08-22  Jackson Harper  <[email protected]>

	* DataGrid.cs (RenderTable): Make sure the new table gets the
	correct style.
	(CreateColumnSet): Clear the data source columnbs before adding
	new ones regardless of whether or not a property descriptor was
	found.
	(InitializePager): pager_cell needs to be a member so it isn't
	created more then once per a render.
	(InitializeNumericPager): Compute start and end more
	correctly.
	- Link commands are 1 indexed.
	(CreateControlHierarchy): Clear the table before we begin
	rendering.
	- Revert patch that made adding the pagers conditional. This is
	incorrect, the pagers are always added. Only their visibility is
	affected by the pager style.
	- Save the entire count in the viewstate, not just the rendered
	count. So when paging is enabled the pager's count isn't broken by
	postback.

2005-08-17  Jackson Harper  <[email protected]>

	* DataGrid.cs: Only create one pager and add it to both the top
	and bottom of the grid, this way all the id numbers stay the same
	and we save a bunch of cycles.

2005-08-17  Jackson Harper  <[email protected]>

	* DataGrid.cs: The top and bottom pagers are always created. Just
	the visibility is changed by the PagerStyle::Position.

2005-08-15  Jackson Harper  <[email protected]>

	* EditCommandColumn.cs: Use a normal LinkButton.

2005-08-12  Jackson Harper  <[email protected]>

	* TableRow.cs: No AutoID for TableRows.

2005-08-12  Jackson Harper  <[email protected]>

	* DataGrid.cs (CreateRenderColumns): If we aren't using data
	binding grab the rendercols from the data source columns.
	(LoadViewState): Restore the bound columns when reloading the
	viewstate.
	(InitializeNumericPager): Create elipsised pagers.
	(CreateItem): Don't set the item's ID.
	(CreateItem): Add the control to the table before it is databound
	so that it's value is saved in the viewstate.
	(CreateControlHierarchy): Create a fake data source when not using
	databinding. Don't add controls to the table as they are added in
	CreateItem now.
	(PrepareControlHierarchy): Make footers and header non visible if
	they aren't enabled.

2005-08-12  Jackson Harper  <[email protected]>

	* BoundColumn.cs: Set the controls text instead of adding a
	literal control. So it is saved in the controls viewstate.

2005-08-11  Jackson Harper  <[email protected]>

	* CheckBoxList.cs: Set the tabindex on the checkbox control and
	don't render it on the main table (Setting it to zero causes it to
	not be rendered). Also use the invariant culture on the id.

2005-08-10  Jackson Harper  <[email protected]>

	* PagedDataSource.cs: Respect paging with all data source types.

2005-08-08  Jackson Harper  <[email protected]>

	* DataGrid.cs: Apply the styles to each item type. 

2005-08-08  Jackson Harper  <[email protected]>

	* PagedDataSource.cs: If paging is not enabled keep enumerating to
	the end of the list.

2005-08-05  Jackson Harper  <[email protected]>

	* DataGrid.cs: Don't make the current page index a link in the
	pager.

2005-08-05  Jackson Harper  <[email protected]>

	* DataGrid.cs: Honour PagerPosition.

2005-08-05  Jackson Harper  <[email protected]>

	* PagedDataSource.cs: Round PageCount properly.

2005-08-04  Jackson Harper  <[email protected]>

	* DataGrid.cs: Add a new space control for each link. Also make
	the link's text 1 indexed. Don't add the space after the last
	item.

2005-08-03  Jackson Harper  <[email protected]>

	* BoundColumn.cs: Respek for the thisExpr when data binding.

2005-08-03  Jackson Harper  <[email protected]>

	* ButtonColumn.cs: Partial implementation.

2005-08-03  Jackson Harper  <[email protected]>

	* DataGrid.cs: Merge the table style with the render table. Some
	initial work on the numeric pager. Remove some debugging code.
	
2005-08-03  Jackson Harper  <[email protected]>

	* BoundColumn.cs: Implement Initialize and InitializeCell. When
	Data is formated it uses the DataFormatString that was set at the
	time Initialize was called (or null if initialize was never
	called).

2005-08-01  Jackson Harper  <[email protected]>

	* TableStyle.cs: Copy style bit when copying from another style.

2005-08-01  Jackson Harper  <[email protected]>

	* PagedDataSource.cs: Implement missing properties, use yield for
	the Enumerator methods. Only allow the enums to return one page at
	a time.

2005-07-25  Jackson Harper  <[email protected]>

	* DataGrid.cs: Set the command name and args on the link buttons.

2005-07-25  Jackson Harper  <[email protected]>

	* DataGrid.cs: Lots o implementation.

2005-07-25  Jackson Harper  <[email protected]>

	* BoundColumn.cs: Partial implementation to get the DataGrid tests
	passing again.

2005-07-20  Jackson Harper  <[email protected]>

	* DataGrid.cs: Store the data source created columns in a 
	  DataGridColumnCollection. This way they can be put in the 
	  view state more easily, and accessed without casting.

2005-07-20  Jackson Harper  <[email protected]>

	* DataGrid.cs: Save the data source created column set in the 
	  view state.

2005-07-20  Jackson Harper  <[email protected]>

	* DataGrid.cs: column names are cached and only regenerated if useDataSource
	  is set to true. Otherwise they are just fetched from the last set that 
	  was generated from the source.

2005-07-20  Jackson Harper  <[email protected]>

	* DataGrid.cs: Assign some properties of newly created BoundColumns.

2005-07-20  Jackson Harper  <[email protected]>

	* DataGrid.cs: Add some of the collections. Implement
          column creation.

2005-07-20  Jackson Harper  <[email protected]>

	* PagedDataSource.cs: Implement GetItemProperties, this is
	  needed for the datagrid.

2005-07-19  Jackson Harper  <[email protected]>

	* ListControl.cs: Use Events Add/RemoveHandler. Don't create
	  a viewstate object if all the viewstate stuff is null.

2005-07-19  Jackson Harper  <[email protected]>

	* DataGrid.cs: Implement style properties and viewstate 
	  saving/loading/tracking.

2005-07-19  Jackson Harper  <[email protected]>

	* DataGrid.cs: Implement bubble event.

2005-07-19  Jackson Harper  <[email protected]>

	* DataGrid.cs: New implementation. Just properties and events for 
	  now.

2005-07-18  Jackson Harper  <[email protected]>

	* CheckBoxList.cs: Implement LoadPostBackData. Also register 
	  checkboxes for postback if they are checked so we can find
	  out when they are unchecked. Copy the AutoPostBack variable 
	  to the to be rendered checkbox when rendering.

2005-07-15  Jackson Harper  <[email protected]>

	* CheckBoxList.cs: Use the index as the ID, the rest of the 
	  id is built by being in the NamingContainer.

2005-07-15  Jackson Harper  <[email protected]>

	* ListControl.cs: Use enum instead of string. Saves a lookup. 

2005-07-15  Jackson Harper  <[email protected]>

	* CheckBoxList.cs: FindControl always returns 'this' according
	  to my probing.

2005-07-15  Jackson Harper  <[email protected]>

	* CheckBoxList.cs: New impl.

2005-07-15  Jackson Harper  <[email protected]>

	* WebControl.cs: Use the ClientID when rendering a controls ID
	  attribute so that naming containers are honoured. 

2005-07-15  Jackson Harper  <[email protected]>

	* ListControl.cs: use the state manager interface for tracking
	  the viewstate.

2005-07-15  Jackson Harper  <[email protected]>

	* ListControl.cs: Simplify comparison. 

2005-07-15  Jackson Harper  <[email protected]>

	* ListControl.cs:
	* Repeater.cs: Use new utility class for resolving data sources.

2005-07-15  Jackson Harper  <[email protected]>

	* ListControl.cs: Add attributes so the sub items get parsed 
	  properly. Remove old unneeded code for resolving lists.

2005-07-15  Jackson Harper  <[email protected]>

	* ListControl.cs: Use the DataSourceHelper so DataMembers are 
	  resolved properly.

2005-07-14  Jackson Harper  <[email protected]>

	* ListControl.cs: Use DataBinder.Eval for data binding. This is more
	code-reuse-arific. Also use the IStateManager interface for loading
	data instead of the old internal method.

2005-07-14  Jackson Harper  <[email protected]>

	* ListControl.cs: Initial implementation of Databinding. Make sure
	that the ListItemCollection is created when we load its ViewState. 

2005-07-14  Jackson Harper  <[email protected]>

	* ListControl.cs: Fix typo.

2005-07-14  Jackson Harper  <[email protected]>

	* ListControl.cs: New Implementation. Lacks databinding support.

2005-07-13  Jackson Harper  <[email protected]>

	* ListBox.cs: Some parameter checking.

2005-07-13  Jackson Harper  <[email protected]>

	* ListBox.cs: Use invariant culture when doing a ToString,
	  set value to the item's value, not to its Text.

2005-07-12  Jackson Harper  <[email protected]>

	* ListBox.cs: Even track default values in the viewstate. Call
	  base's RenderContents.

2005-07-12  Jackson Harper  <[email protected]>

	* ListBox.cs: New impl.

2005-07-08  Jackson Harper  <[email protected]>

	* Literal.cs: New implentation.
	* MonthChangedEventArgs.cs: new
	* MonthChangedEventHandler.cs: new
	
2005-07-08  Jackson Harper  <[email protected]>

	* AdCreatedeventArgs.cs: New implementation.

svn path=/trunk/mcs/; revision=48920
2005-08-26 22:27:06 +00:00

485 lines
11 KiB
C#

//
// System.Web.UI.WebControls.ListControl.cs
//
// Authors:
// Jackson Harper ([email protected])
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Drawing;
using System.Web.Util;
using System.Collections;
using System.Globalization;
using System.ComponentModel;
using System.Collections.Specialized;
namespace System.Web.UI.WebControls {
[DataBindingHandler("System.Web.UI.Design.WebControls.ListControlDataBindingHandler, " + Consts.AssemblySystem_Design)]
[DefaultEventAttribute ("SelectedIndexChanged")]
[DefaultPropertyAttribute ("DataSource")]
[Designer("System.Web.UI.Design.WebControls.ListControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
#if NET_2_0
[ControlValueProperty ("SelectedValue", null)]
[ParseChildrenAttribute (true, "Items", ChildControlType = typeof (Control))]
#else
[ParseChildrenAttribute (true, "Items")]
#endif
public abstract class ListControl :
#if NET_2_0
DataBoundControl, IEditableTextControl, ITextControl
#else
WebControl
#endif
{
private static readonly object SelectedIndexChangedEvent = new object ();
#if NET_2_0
private static readonly object TextChangedEvent = new object ();
#endif
private object data_source;
private ListItemCollection items;
public ListControl () : base (HtmlTextWriterTag.Select)
{
}
#if NET_2_0
[DefaultValue (false)]
[Themeable (false)]
[MonoTODO]
public virtual bool AppendDataBoundItems
{
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
#endif
#if NET_2_0
[Themeable (false)]
#endif
[DefaultValue(false)]
public virtual bool AutoPostBack {
get { return ViewState.GetBool ("AutoPostBack", false); }
set { ViewState ["AutoPostBack"] = value; }
}
#if ONLY_1_1
[DefaultValue("")]
public virtual string DataMember {
get { return ViewState.GetString ("DataMember", String.Empty); }
set { ViewState ["DataMember"] = value; }
}
[Bindable(true)]
[DefaultValue(null)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual object DataSource {
get { return data_source; }
set { data_source = value; }
}
#endif
#if NET_2_0
[Themeable (false)]
#endif
[DefaultValue("")]
public virtual string DataTextField {
get { return ViewState.GetString ("DataTextField", String.Empty); }
set { ViewState ["DataTextField"] = value; }
}
#if NET_2_0
[Themeable (false)]
#endif
[DefaultValue("")]
public virtual string DataTextFormatString {
get { return ViewState.GetString ("DataTextFormatString", String.Empty); }
set { ViewState ["DataTextFormatString"] = value; }
}
#if NET_2_0
[Themeable (false)]
#endif
[DefaultValue("")]
public virtual string DataValueField {
get { return ViewState.GetString ("DataValueField", String.Empty); }
set { ViewState ["DataValueField"] = value; }
}
#if NET_2_0
[Editor ("System.Web.UI.Design.WebControls.ListItemsCollectionEditor," + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing)]
#endif
[DefaultValue(null)]
[MergableProperty(false)]
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public virtual ListItemCollection Items {
get {
if (items == null)
items = new ListItemCollection ();
return items;
}
}
// I can't find this info stored in the viewstate anywhere
// so it must be calculated on the fly.
[Bindable(true)]
[Browsable(false)]
[DefaultValue(0)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#if NET_2_0
[Themeable (false)]
#endif
public virtual int SelectedIndex {
get {
if (items == null)
return -1;
for (int i = 0; i < items.Count; i++) {
if (items [i].Selected)
return i;
}
return -1;
}
set {
ClearSelection ();
if (value == -1 || items == null)
return;
if (value < 0 || value >= Items.Count)
throw new ArgumentOutOfRangeException ("value");
items [value].Selected = true;
}
}
[Browsable(false)]
[DefaultValue(null)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual ListItem SelectedItem {
get {
int si = SelectedIndex;
if (si == -1)
return null;
return Items [si];
}
}
#if NET_2_0
[Bindable(true, BindingDirection.TwoWay)]
[Themeable (false)]
#else
[Bindable(true)]
#endif
[Browsable(false)]
[DefaultValue("")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public virtual string SelectedValue {
get {
int si = SelectedIndex;
if (si == -1)
return String.Empty;
return Items [si].Value;
}
set {
ClearSelection ();
for (int i = 0; i < Items.Count; i++) {
if (Items [i].Value == value)
Items [i].Selected = true;
}
}
}
#if NET_2_0
[Themeable (false)]
[DefaultValue ("")]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
[Browsable (false)]
[MonoTODO]
public virtual string Text
{
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
[MonoTODO]
protected virtual new HtmlTextWriterTag TagKey
{
get {
throw new NotImplementedException ();
}
}
protected override void AddAttributesToRender (HtmlTextWriter w)
{
base.AddAttributesToRender (w);
}
#endif
public virtual void ClearSelection ()
{
if (items == null)
return;
int count = Items.Count;
for (int i = 0; i<count; i++)
items [i].Selected = false;
}
#if NET_2_0
[MonoTODO]
protected internal override void LoadControlState (object savedState)
{
throw new NotImplementedException ();
}
#endif
protected override void OnDataBinding (EventArgs e)
{
base.OnDataBinding (e);
IEnumerable list = DataSourceResolver.ResolveDataSource (DataSource, DataMember);
if (list == null)
return;
Items.Clear ();
foreach (object container in list) {
string text;
string value;
if (DataTextField != String.Empty) {
text = DataBinder.Eval (container,
DataTextField).ToString ();
} else {
text = String.Empty;
}
if (DataValueField != String.Empty) {
value = DataBinder.Eval (container,
DataValueField).ToString ();
} else {
value = text;
}
if (text == String.Empty) {
if (value != String.Empty)
text = value;
} else if (DataTextFormatString != String.Empty) {
// Dont apply the format string if we don't actually
// have a textfield
text = String.Format (DataTextFormatString, text);
}
ListItem item = new ListItem (text, value);
Items.Add (item);
}
}
#if NET_2_0
[MonoTODO]
protected internal override void OnInit (EventArgs e)
{
throw new NotImplementedException ();
}
#endif
#if NET_2_0
protected internal
#else
protected
#endif
override void OnPreRender (EventArgs e)
{
base.OnPreRender (e);
}
#if NET_2_0
[MonoTODO]
protected virtual void OnTextChanged (EventArgs e)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected internal override void PerformDataBinding (IEnumerable dataSource)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected override void PerformSelect ()
{
throw new NotImplementedException ();
}
[MonoTODO]
protected internal override void RenderContents (HtmlTextWriter w)
{
throw new NotImplementedException ();
}
[MonoTODO]
protected internal override object SaveControlState ()
{
throw new NotImplementedException ();
}
#endif
protected override object SaveViewState ()
{
object first = null;
object second = null;
ArrayList selected = null;
first = base.SaveViewState ();
IStateManager manager = items as IStateManager;
if (manager != null)
second = manager.SaveViewState ();
if (items != null) {
selected = new ArrayList ();
int count = Items.Count;
for (int i = 0; i < count; i++) {
if (items [i].Selected)
selected.Add (i);
}
}
if (first == null && second == null && selected == null)
return null;
return new Triplet (first, second, selected);
}
protected override void LoadViewState (object savedState)
{
object first = null;
object second = null;
ArrayList indices = null;
Triplet triplet = savedState as Triplet;
if (triplet != null) {
first = triplet.First;
second = triplet.Second;
indices = triplet.Third as ArrayList;
}
base.LoadViewState (first);
if (second != null) {
IStateManager manager = Items as IStateManager;
manager.LoadViewState (second);
}
if (indices != null) {
foreach (int index in indices)
Items [index].Selected = true;
}
}
#if NET_2_0
[MonoTODO]
protected void SetPostDataSelection (int selectedIndex)
{
throw new NotImplementedException ();
}
#endif
protected override void TrackViewState ()
{
base.TrackViewState ();
IStateManager manager = items as IStateManager;
if (manager != null)
manager.TrackViewState ();
}
protected virtual void OnSelectedIndexChanged (EventArgs e)
{
EventHandler handler = (EventHandler) Events [SelectedIndexChangedEvent];
if (handler != null)
handler (this, e);
}
#if NET_2_0
protected internal virtual void VerifyMultiSelect ()
{
}
#endif
public event EventHandler SelectedIndexChanged {
add { Events.AddHandler (SelectedIndexChangedEvent, value); }
remove { Events.RemoveHandler (SelectedIndexChangedEvent, value); }
}
#if NET_2_0
/* sealed in the docs */
public event EventHandler TextChanged {
add {
Events.AddHandler (TextChangedEvent, value);
}
remove {
Events.RemoveHandler (TextChangedEvent, value);
}
}
[MonoTODO]
[Themeable (false)]
[DefaultValue (false)]
public virtual bool CausesValidation {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
[MonoTODO]
[Themeable (false)]
[DefaultValue ("")]
public virtual string ValidationGroup {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
#endif
}
}