473,396 Members | 1,786 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,396 software developers and data experts.

HTML-ize a server-side control

Hi all,

Perhaps I've drawn a blank here but is there any way for me to use the
server-side objects (perhaps the HTMLTable in conjunction with
HTMLTableCell) to create a table with multiple rows and cells and then dump
the HTMLTable object into my source?

I use these controls when I need to gain access to cells and such upon
postbacks but was wondering about doing this the other way around as opposed
to building a long string using the StringBuilder.Append method.

Perhaps build the whole table object and somehow dump it into a literal
control?

Thanks in advance for any help forthcoming...

Regards
John.
Dec 14 '05 #1
5 1079
maybe this


"John" <a@b.c> wrote in message news:O7**************@TK2MSFTNGP10.phx.gbl...
Hi all,

Perhaps I've drawn a blank here but is there any way for me to use the server-side objects (perhaps the HTMLTable in conjunction
with HTMLTableCell) to create a table with multiple rows and cells and then dump the HTMLTable object into my source?

I use these controls when I need to gain access to cells and such upon postbacks but was wondering about doing this the other way
around as opposed to building a long string using the StringBuilder.Append method.

Perhaps build the whole table object and somehow dump it into a literal control?

Thanks in advance for any help forthcoming...

Regards
John.

Dec 14 '05 #2

maybe this

http://msdn.microsoft.com/library/de...classtopic.asp



"John" <a@b.c> wrote in message news:O7**************@TK2MSFTNGP10.phx.gbl...
Hi all,

Perhaps I've drawn a blank here but is there any way for me to use the server-side objects (perhaps the HTMLTable in conjunction
with HTMLTableCell) to create a table with multiple rows and cells and then dump the HTMLTable object into my source?

I use these controls when I need to gain access to cells and such upon postbacks but was wondering about doing this the other way
around as opposed to building a long string using the StringBuilder.Append method.

Perhaps build the whole table object and somehow dump it into a literal control?

Thanks in advance for any help forthcoming...

Regards
John.

Dec 14 '05 #3
Hi all,

Never mind - I figured it out- pretty powerful stuff!

Regards
John.

"John" <a@b.c> wrote in message
news:O7**************@TK2MSFTNGP10.phx.gbl...
Hi all,

Perhaps I've drawn a blank here but is there any way for me to use the
server-side objects (perhaps the HTMLTable in conjunction with
HTMLTableCell) to create a table with multiple rows and cells and then
dump the HTMLTable object into my source?

I use these controls when I need to gain access to cells and such upon
postbacks but was wondering about doing this the other way around as
opposed to building a long string using the StringBuilder.Append method.

Perhaps build the whole table object and somehow dump it into a literal
control?

Thanks in advance for any help forthcoming...

Regards
John.

Dec 14 '05 #4
I'm not shure wether this is what you want to achieve. Anyway,
You can use the RenderControl method of the control (here Table control);
Example:

Let's say your Table-control is called tblData

Table tblData = new Table();
//Now fill your table with your data
//...
//..

System.IO.StringWriter sWriter = new System.IO.StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(sWriter);
tblData.RenderControl(htmlWriter);
string htmlCodeForTable = sWriter.ToString();

Marius

"John" <a@b.c> wrote in message
news:O7**************@TK2MSFTNGP10.phx.gbl...
Hi all,

Perhaps I've drawn a blank here but is there any way for me to use the
server-side objects (perhaps the HTMLTable in conjunction with
HTMLTableCell) to create a table with multiple rows and cells and then
dump the HTMLTable object into my source?

I use these controls when I need to gain access to cells and such upon
postbacks but was wondering about doing this the other way around as
opposed to building a long string using the StringBuilder.Append method.

Perhaps build the whole table object and somehow dump it into a literal
control?

Thanks in advance for any help forthcoming...

Regards
John.

Dec 14 '05 #5
I know you've figured it out, but another option is to add your newly
created HTML Table as a child of an existing control

example: page.controls.add

This has additional benefits over the simple render html that I'll
leave you to discover :)

Dec 14 '05 #6

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

Similar topics

20
by: Al Moritz | last post by:
Hi all, I was always told that the conversion of Word files to HTML as done by Word itself sucks - you get a lot of unnecessary code that can influence the design on web browsers other than...
6
by: Ludwig77 | last post by:
When I was first taught html several years ago, I was taught that the following tags are standard for any html formatted message: <HTML> <HEAD> </HEAD> </BODY> </HTML> In fact, I was taught...
1
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML...
33
by: LRW | last post by:
http://gto.ie-studios.net/index.php When you view the above site in IE, if the 1st of the three product images is tall enough to push the cell down a couple of pixels, IE somehow doesn't show...
9
by: Patient Guy | last post by:
Taking the BODY element as an example, all of its style attributes ('alink', 'vlink', 'background', 'text', etc.) are deprecated in HTML 4.01, a fact noted in the DOM Level 2 HTML specification. ...
7
by: Xah Lee | last post by:
Summary: when encountering ex as a unit in css, FireFox (and iCab) did not take into account the font-family. Detail: http://xahlee.org/js/ff_pre_ex.html Xah xah@xahlee.org ∑...
8
by: rn5a | last post by:
I have a HTML page named Index.html which is divided into 3 frames. The URL of 2 of the frames are HTML pages but the 3rd frame houses a ASP page. Now when I go to Windows Explorer, navigate to...
6
by: Guy Macon | last post by:
cwdjrxyz wrote: HTML 5 has solved the above probem. See the following web page: HTML 5, one vocabulary, two serializations http://www.w3.org/QA/2008/01/html5-is-html-and-xml.html
4
Dököll
by: Dököll | last post by:
Hey Gang! I thought I had a good idea but then I realized JSF doesn't play that... I am trying to mimick what HTML can do in JSF when using target tags to related to inner HTML pages. In...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...

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.