2 * Namespace: System.Web.UI.WebControls
\r
3 * Class: BaseDataList
\r
5 * Author: Gaurav Vaish
\r
6 * Maintainer: gvaish@iitk.ac.in
\r
7 * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
\r
10 * (C) Gaurav Vaish (2001)
\r
14 using System.Collections;
\r
16 using System.Web.UI;
\r
18 namespace System.Web.UI.WebControls
\r
20 public abstract class BaseDataList: WebControl
\r
23 private int cellPadding = -1;
\r
24 private int cellSpacing = 0;
\r
25 private object dataSource = null;
\r
26 private string dataKeyField = String.Empty;
\r
27 private DataKeyCollection dataKeys; // TODO: From where do get the values into it?
\r
28 private string dataMember;
\r
29 private GridLines gridLines;
\r
30 private HorizontalAlign hAlign;
\r
32 public BaseDataList()
\r
35 dataKeys = new DataKeyCollection(new ArrayList());
\r
36 dataMember = String.Empty;
\r
37 gridLines = GridLines.Both;
\r
38 hAlign = HorizontalAlign.NotSet;
\r
41 public static bool IsBindableType(Type type)
\r
43 //TODO: To see what has to be here
\r
44 if(type.IsPrimitive)
\r
46 //Type.GetTypeFromHandle(new RuntimeTypeHandle());
\r
48 return false; //for the time being, to be able to make it compile
\r
51 public virtual int CellPadding
\r
59 cellPadding = value;
\r
63 public virtual int CellSpacing
\r
71 cellSpacing = value;
\r
75 public virtual string DataKeyField
\r
79 return dataKeyField;
\r
83 dataKeyField = value;
\r
87 public DataKeyCollection DataKeys
\r
95 public string DataMember
\r
103 dataMember = value;
\r
107 public virtual object DataSource
\r
115 dataSource = value;
\r
119 public virtual GridLines GridLines
\r
131 public virtual HorizontalAlign HorizontalAlign
\r
143 public override void DataBind()
\r
145 // TODO: have to write the implementation
\r
146 // I am not sure of whether it will be of any use here since
\r
147 // I am an abstract class, and have no identity of myself.
\r
148 //dataBindEventArgs = EventArgs.Empty;
\r
149 OnDataBinding(EventArgs.Empty);
\r
150 throw new NotImplementedException();
\r
153 //TODO: Check - where are the following abstract methods?
\r
155 * CreateControlHierarchy(bool)
\r
156 * PrepareControlHierarchy()
\r
159 protected override void AddParsedSubObject(object o)
\r
161 // Preventing literal controls from being added as children: Do nothing here.
\r
164 protected override void CreateChildControls()
\r
167 if(ViewState["_!ItemCount"]!=null)
\r
169 CreateControlHierarchy(true);
\r
170 ClearChildViewState();
\r
174 protected abstract void CreateControlHierarchy(bool useDataSource);
\r