Files
mono/mcs/class/System.Web/System.Web.UI/DataBoundLiteralControl.cs
T
Gonzalo Paniagua Javier 087e90c0ff 2002-06-20 Gonzalo Paniagua Javier <[email protected]>
* System.Web.UI/Control.cs:
	(AddedControl): new function that is called whenever a control is
	added to a collection of controls in a container. It sets the defaults
	except for Page.

	* System.Web.UI/ControlCollection.cs: call AddedControl in Add/AddAt.

	* System.Web.UI/DataBoundLiteralControl.cs: implemented constructor,
	Text, Render, SetStaticString and SetDataBoundString.

	* System.Web.UI/Page.cs: removed SetDefaults.

	* System.Web.UI.WebControls/Repeater.cs: implemented
	CreateControlHierarchy. Fixed some event processing methods.

svn path=/trunk/mcs/; revision=5357
2002-06-20 07:59:53 +00:00

80 lines
1.7 KiB
C#
Executable File

//
// System.Web.UI.DataBoundLiteralCOntrol.cs
//
// Authors:
// Duncan Mak ([email protected])
// Gonzalo Paniagua Javier ([email protected])
//
// (C) 2002 Ximian, Inc. (http://www.ximian.com)
//
using System;
using System.Text;
namespace System.Web.UI {
public sealed class DataBoundLiteralControl : Control
{
private string [] staticLiterals;
private string [] dataBoundLiterals;
public DataBoundLiteralControl (int staticLiteralsCount,
int dataBoundLiteralCount)
{
staticLiterals = new string [staticLiteralsCount];
dataBoundLiterals = new string [dataBoundLiteralCount];
PreventAutoID ();
}
public string Text {
get {
StringBuilder text = new StringBuilder ();
int stLength = staticLiterals.Length;
int dbLength = dataBoundLiterals.Length;
int max = (stLength > dbLength) ? stLength : dbLength;
for (int i = 0; i < max; i++){
if (i < stLength)
text.Append (staticLiterals [i]);
if (i < dbLength)
text.Append (dataBoundLiterals [i]);
}
return text.ToString ();
}
}
protected override ControlCollection CreateControlCollection ()
{
return new EmptyControlCollection (this);
}
[MonoTODO]
protected override void LoadViewState (object savedState)
{
throw new NotImplementedException ();
}
protected override void Render (HtmlTextWriter output)
{
output.Write (Text);
}
[MonoTODO]
protected override object SaveViewState ()
{
throw new NotImplementedException ();
}
public void SetDataBoundString (int index, string s)
{
dataBoundLiterals [index] = s;
}
public void SetStaticString (int index, string s)
{
staticLiterals [index] = s;
}
}
}