Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework.aspnet.mobile
RE: ObjectList.RenderControl
(Ramkumar Raja)
2/21/2002 6:10:00 PM
1 Answer
Sherri Scalish
2/21/2002 9:05:00 PM
0
Hi Ramkumar:
Thanks for replying, but I have already looked at this
article and many more. What I want to accomplish is for
the the control to render itself to an HtmlTextWriter
programatically, and I have not been able to accomplish
this. Here is a sample of the code I am using if that
helps:
...
private class TestStuff
{
private String fieldName;
private String fieldDescription;
private String fieldComment;
public TestStuff(string name,
string desc, string cmt)
{
this.fieldName = name;
this.fieldDescription =
desc;
this.fieldComment = cmt;
}
public string Name{ get { return
this.fieldName; } }
public string Description{ get {
return this.fieldDescription; } }
public string Comment{ get {return
this.fieldComment; } }
}
private void Page_Load(object sender,
System.EventArgs e)
{
ArrayList ar = new ArrayList();
StringWriter sw = new StringWriter
();
HtmlTextWriter htm = new
HtmlTextWriter(sw);
ar.Add(new TestStuff
("Field1", "This is the first", "Yes"));
ar.Add(new TestStuff
("Field2", "This is the second", "NO"));
ar.Add(new TestStuff
("Field3", "This is the third", "Okeydoey"));
this.ObjectList1.DataSource = ar;
//this.ObjectList1.LabelField
= "Comment";
this.ObjectList1.DataBind();
this.ObjectList1.RenderControl
(htm);
...
}
...
The last line is where I get a NullExceptionError even
though the ObjectList is not null, the StringWriter and
HtmlTextWriter are not null.
Sherri
>-----Original Message-----
>Hi Sherri,
>
>Please take a look at the following link
>
>
http://msdn.microsoft.com/library/de...
url=/library/en-us/cpref/html/
>frlrfSystemWebUIControlClassRenderControlTopic.asp
>
>Hope this helps.
>
>Ramkumar Raja
>Microsoft Developer Support
>This posting is provided "AS IS" with no warranties, and
confers no rights.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
RE: ObjectList.RenderControl
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password