473,395 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Dynamic HttpTableRow not rendering cell content...

All:

I have a control that renders a table. As the table is rendered, each
row in the table is constructed by creating a run-time (dynamic)
object that is derived from an HtmlTableRow. The row has three
HtmlTableCell objects, and each cell contains a single control added
to the HtmlTableCell's Controls collection. The basic table renders
correctly, but the controls within the HtmlTableCell objects do not;
the cells are just empty. (Just <TD></TD> tags).

I add the controls to each cell in my derived class constructor, and
that code fires in the debugger. The controls just don't render.

I'm sure there is a very basic problem I'm overlooking, but I'm
stymied as to what it is.

I'd greatly appreciate any thoughts.

David

ps Please reply to group; email in message is long since dead.
Nov 17 '05 #1
3 3010
David,
Did you override the render method in the class that derives from
HtmlTableRow? Something like this:
protected override void Render(HtmlTextWriter writer)
{
writer.Write(this.Text);
}

You didn't provide any code so I'm asking the obvious.

Louis Dascoulias, AWS

"David Whitney" <in*********@hotmail.com> wrote in message
news:63**************************@posting.google.c om...
All:

I have a control that renders a table. As the table is rendered, each
row in the table is constructed by creating a run-time (dynamic)
object that is derived from an HtmlTableRow. The row has three
HtmlTableCell objects, and each cell contains a single control added
to the HtmlTableCell's Controls collection. The basic table renders
correctly, but the controls within the HtmlTableCell objects do not;
the cells are just empty. (Just <TD></TD> tags).

I add the controls to each cell in my derived class constructor, and
that code fires in the debugger. The controls just don't render.

I'm sure there is a very basic problem I'm overlooking, but I'm
stymied as to what it is.

I'd greatly appreciate any thoughts.

David

ps Please reply to group; email in message is long since dead.

Nov 17 '05 #2
The short answer is no, I didn't, but here's why I didn't...

I presumed, probably incorrectly, that each element still knows how to
render itself, and that rendering a table row would be a matter of
rendering a cell, then its contents, etc, then the next cell, its
contents, etc... which would be part of its default behavior.

The code is essentially like this - note this is just scratched out
from memory - I'm away from my source at the moment.

public void MyDerivedHtmlTableRow(string somevalue)
{
HtmlTableCell hc = new HtmlTableCell();
HtmlInputBox ib = new HtmlInputBox();
ib.Text=somevalue;

hc.Controls.Add(ib);

//... add two other cells/controls similarly

this.Cells.Add(hc);
}

The calling class - a control - uses it like this:

public void AddTableRow()
{
for (x=1;x<=10;x++)
table.Rows.AddAt(number,
new MyDerivedTableRow(System.Convert.ToString(x))));
}

Since the *rows* rendered, but just not their contents, it seemed I
didn't need to implement custom rendering; the controls on each table
cell were not being rendered. If I'm just missing the boat on where to
do some rendering overrides, that's cool, I'm just trying to figure
out the right place...and a bit of where I might be confused..or is it
something as simple as

protected override void Render(HtmlTextWriter writer)
{
writer.Write(<TR>);
//custom render the first cell, and its one child control??
//custom render the second cell??
writer.Write(</TR>);

//or

//call an existing rendering method on the cell and its child
control??
}

Thoughts? (And thanks for your help, too!)

-David

"Louis Dascoulias" <lo****@automark.net> wrote in message news:<e1**************@TK2MSFTNGP12.phx.gbl>...
David,
Did you override the render method in the class that derives from
HtmlTableRow? Something like this:
protected override void Render(HtmlTextWriter writer)
{
writer.Write(this.Text);
}

You didn't provide any code so I'm asking the obvious.

Louis Dascoulias, AWS

"David Whitney" <in*********@hotmail.com> wrote in message
news:63**************************@posting.google.c om...
All:

I have a control that renders a table. As the table is rendered, each
row in the table is constructed by creating a run-time (dynamic)
object that is derived from an HtmlTableRow. The row has three
HtmlTableCell objects, and each cell contains a single control added
to the HtmlTableCell's Controls collection. The basic table renders
correctly, but the controls within the HtmlTableCell objects do not;
the cells are just empty. (Just <TD></TD> tags).

I add the controls to each cell in my derived class constructor, and
that code fires in the debugger. The controls just don't render.

I'm sure there is a very basic problem I'm overlooking, but I'm
stymied as to what it is.

I'd greatly appreciate any thoughts.

David

ps Please reply to group; email in message is long since dead.

Nov 17 '05 #3
David,

It finally occured to me: you must assign an ID to the child control.
Nothing will automatically assign one to the control.

Previous thoughts:
You may need to call EnsureChildControls at some point after adding
the textboxes to the cell since the textboxes aren't a component/property
of the cells.

I played around with createing 'table-maker' controls in VB.Net a while back
so I can provide some code if needed..

Louis Dascoulias, AWS

"David Whitney" <in*********@hotmail.com> wrote in message
news:63**************************@posting.google.c om...
The short answer is no, I didn't, but here's why I didn't...

I presumed, probably incorrectly, that each element still knows how to
render itself, and that rendering a table row would be a matter of
rendering a cell, then its contents, etc, then the next cell, its
contents, etc... which would be part of its default behavior.

The code is essentially like this - note this is just scratched out
from memory - I'm away from my source at the moment.

public void MyDerivedHtmlTableRow(string somevalue)
{
HtmlTableCell hc = new HtmlTableCell();
HtmlInputBox ib = new HtmlInputBox();
ib.Text=somevalue;

hc.Controls.Add(ib);

//... add two other cells/controls similarly

this.Cells.Add(hc);
}

The calling class - a control - uses it like this:

public void AddTableRow()
{
for (x=1;x<=10;x++)
table.Rows.AddAt(number,
new MyDerivedTableRow(System.Convert.ToString(x))));
}

Since the *rows* rendered, but just not their contents, it seemed I
didn't need to implement custom rendering; the controls on each table
cell were not being rendered. If I'm just missing the boat on where to
do some rendering overrides, that's cool, I'm just trying to figure
out the right place...and a bit of where I might be confused..or is it
something as simple as

protected override void Render(HtmlTextWriter writer)
{
writer.Write(<TR>);
//custom render the first cell, and its one child control??
//custom render the second cell??
writer.Write(</TR>);

//or

//call an existing rendering method on the cell and its child
control??
}

Thoughts? (And thanks for your help, too!)

-David

"Louis Dascoulias" <lo****@automark.net> wrote in message

news:<e1**************@TK2MSFTNGP12.phx.gbl>...
David,
Did you override the render method in the class that derives from
HtmlTableRow? Something like this:
protected override void Render(HtmlTextWriter writer)
{
writer.Write(this.Text);
}

You didn't provide any code so I'm asking the obvious.

Louis Dascoulias, AWS

"David Whitney" <in*********@hotmail.com> wrote in message
news:63**************************@posting.google.c om...
All:

I have a control that renders a table. As the table is rendered, each
row in the table is constructed by creating a run-time (dynamic)
object that is derived from an HtmlTableRow. The row has three
HtmlTableCell objects, and each cell contains a single control added
to the HtmlTableCell's Controls collection. The basic table renders
correctly, but the controls within the HtmlTableCell objects do not;
the cells are just empty. (Just <TD></TD> tags).

I add the controls to each cell in my derived class constructor, and
that code fires in the debugger. The controls just don't render.

I'm sure there is a very basic problem I'm overlooking, but I'm
stymied as to what it is.

I'd greatly appreciate any thoughts.

David

ps Please reply to group; email in message is long since dead.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Juha Rossi | last post by:
Hi, Im designing web site like below: ----------------------------------------------------------- | logo here | welcome text here | | | |...
6
by: Trevor Hartman | last post by:
Hi, I need to refer to my objects dynamically. I have a 7 table cells (sunCell, monCell, tueCell....). I am looping through some data, checking its date and adding it to the correct cell. I...
3
by: Chris Thunell | last post by:
I have an aspx web form with a table that i'm sending via response.write... in one of the cells i would like to put a dynamically created server control. The amount of rows is variable... so i...
7
by: Andrew Robinson | last post by:
Given HTML text (likely from SQL), is there any method that could be employed to render server and/or custom controls that are contained inside of that text? I would be loading content from a...
4
by: UJ | last post by:
I'm a newbie to this so please excuse the level of question. My question is how can I dynamically create a table in the middle of a page without having to build the entire page dynamically? I have...
0
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
0
by: Francois | last post by:
I have to modify existing code : Basically, it implemnts tabbed forms. On the pageLoad, the code creates the two selection controls, plus kind of page depending of selected control. On...
19
by: Rabel | last post by:
I have a page that is using tables (please no comments about this - I understand it should be css but firefox created this template) I have a menu down the left side and the bottom is supposed to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.