Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DataBoundLiteralControl.cs « System.Web.UI « System.Web « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0eae61eb1a21400da942aa979fe87168bbde5554 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// System.Web.UI.DataBoundLiteralCOntrol.cs
//
// Authors:
// 	Duncan Mak  (duncan@ximian.com)
// 	Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (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;
		}
	}
}