473,837 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3044
David,
Did you override the render method in the class that derives from
HtmlTableRow? Something like this:
protected override void Render(HtmlText Writer writer)
{
writer.Write(th is.Text);
}

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

Louis Dascoulias, AWS

"David Whitney" <in*********@ho tmail.com> wrote in message
news:63******** *************** ***@posting.goo gle.com...
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 MyDerivedHtmlTa bleRow(string somevalue)
{
HtmlTableCell hc = new HtmlTableCell() ;
HtmlInputBox ib = new HtmlInputBox();
ib.Text=someval ue;

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.AddA t(number,
new MyDerivedTableR ow(System.Conve rt.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(HtmlText Writer writer)
{
writer.Write(<T R>);
//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****@automar k.net> wrote in message news:<e1******* *******@TK2MSFT NGP12.phx.gbl>. ..
David,
Did you override the render method in the class that derives from
HtmlTableRow? Something like this:
protected override void Render(HtmlText Writer writer)
{
writer.Write(th is.Text);
}

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

Louis Dascoulias, AWS

"David Whitney" <in*********@ho tmail.com> wrote in message
news:63******** *************** ***@posting.goo gle.com...
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 EnsureChildCont rols 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*********@ho tmail.com> wrote in message
news:63******** *************** ***@posting.goo gle.com...
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 MyDerivedHtmlTa bleRow(string somevalue)
{
HtmlTableCell hc = new HtmlTableCell() ;
HtmlInputBox ib = new HtmlInputBox();
ib.Text=someval ue;

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.AddA t(number,
new MyDerivedTableR ow(System.Conve rt.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(HtmlText Writer writer)
{
writer.Write(<T R>);
//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****@automar k.net> wrote in message

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

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

Louis Dascoulias, AWS

"David Whitney" <in*********@ho tmail.com> wrote in message
news:63******** *************** ***@posting.goo gle.com...
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
4259
by: Juha Rossi | last post by:
Hi, Im designing web site like below: ----------------------------------------------------------- | logo here | welcome text here | | | | ----------------------------------------------------------- | buttons here | | | main content here
6
3533
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 want to be able to do something like: string day; foreach ... { day = getShortDay(someDateTime);
3
1769
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 could have 10 rows / controls. How do i create a server control that goes into the appropriate grid cell? Example: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
7
1509
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 database and would like to 'expand' the server controls. Possibly even recursively. Hope this makes sense, but I am guessing the answer is no. If this is something that can't be done, I am looking at creating my own markup tags and searching for...
4
1461
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 code to build the string that will generate the table. (This is all to solve the problem of when a person clicks a checkbox in a datagrid, there's no way of knowing what record it belongs to - see my previous post) Here's what my code would...
0
5298
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 the days in the week with dates and textboxes to fill in some data. row 1: question
9
2991
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 got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the content takes a long
0
1146
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 selected control_click, do a page redirect to itself, putting in the url the new selected control.
19
2290
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 be as tall as needed to fill the page. This works fine in firefox but not in ie. Here is a link to the page if you would like to see it http://creativeness.com/temptest/storetemplate2.htm I think the problem has to do with the height="*" - I...
0
9844
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9683
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10883
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10631
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9409
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7006
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5851
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4477
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4049
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.