473,406 Members | 2,710 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,406 software developers and data experts.

Getting the HTML for a control

Your gonna ask why would I want to...

One reason is that the unsupported MS Web Tree Control has a text property
on a node, but no Controls collection. To add a control to the node, I need
its HTML, or I need to build it myself (i'd rather not)

Somebody suggested I take a look at the HTML in the OnRender() method.

Sorry to be slow, but how would I get the html for a TextBox control, for
example?

I see a PreRender event..

Nov 19 '05 #1
2 932
Chad wrote:
Sorry to be slow, but how would I get the html for a TextBox control, for
example?

Do this:

//Render the control
TextBox tbx = new TextBox();
tbx.Text = "Hello World!";
HtmlTextWriter writer = new HtmlTextWriter(new StringWriter());
tbx.RenderControl(writer);
// Get the HTML markup
htw.InnerWriter.ToString();

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
Nov 19 '05 #2
Try this code:

Dim SB as New StringBuilder()
Dim SW as New StringWriter(SB)
Dim htmlTW as New HtmlTextWriter(SW)
MyTextBox.RenderControl(htmlTW)
Dim TextBoxHTML as String = SB.ToString()

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Chad" <ch**************@unisys.com> wrote in message
news:ct**********@trsvr.tr.unisys.com...
Your gonna ask why would I want to...

One reason is that the unsupported MS Web Tree Control has a text property
on a node, but no Controls collection. To add a control to the node, I
need
its HTML, or I need to build it myself (i'd rather not)

Somebody suggested I take a look at the HTML in the OnRender() method.

Sorry to be slow, but how would I get the html for a TextBox control, for
example?

I see a PreRender event..

Nov 19 '05 #3

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

Similar topics

1
by: Mohan | last post by:
Hi All, I am using web browser control in a VB 6.0 client server application to print reports. I am writing the report into a HTML file and displays the report to the user using the code,...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
0
by: dipgandhi | last post by:
Hi, I am trying to get the HTML of a button and display it in the textbox in this case. But I always get this error at runtime : "Control 'Button1' of type 'Button' must be placed inside a...
2
by: Gerry Abbott | last post by:
Hi all. Im using abbreviated field names on a form to optimise space, but would like to display for example, the status bar text of the control, onto the form header, when the control has the...
2
by: CDWaddell | last post by:
I have the following cod private void btnUpdate_Click(object sender, System.EventArgs e TextBox tbMembers = new TextBox() tbMembers = (TextBox) dlClubs.FindControl("tbMembers") string...
2
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added...
2
by: Chad | last post by:
In our application, I would like to send out HTML mail. TO do so, I must do something like this: Mail.Body = <raw HTMLTEXT String> Hence, I would like to know how to get the HTML text for Web...
6
by: Samuel Rhodes | last post by:
Hi I am trying to write a code snippet that would display a '?' sign on the top left of a control. I do not want to hard code the positioning of the DIV which will contain that '?'. Is it...
2
by: ITistic | last post by:
In a project I have developed there is one Web User Control which we use on 2 different web forms. In addition to using this control on these web forms we now need to be able to send an email out...
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
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:
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.