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

Server control html

How can i get html generated by a web server control in
the code behid page itself.
i want to store the html in some variable for some
purpose. is it possible.

Nov 19 '05 #1
3 922
This is difficult because some controls dynamically render based upon the
conditions of the request -- primarily based upon browser version. You can
always do some screen scraping to gather the raw HTML output.

-Brock
DevelopMentor
http://staff.develop.com/ballen
How can i get html generated by a web server control in
the code behid page itself.
i want to store the html in some variable for some
purpose. is it possible.


Nov 19 '05 #2
Hello Vikram,

You could do something like this:

[C#]
using (StringWriter writer = new StringWriter())
{
HtmlTextWriter hw = new Html32TextWriter(writer);
myControl.RenderControl(hw);
}

writer.ToString() contains your controls HTML

Keep in mind that as Brock said, some controls alter their output based on
browser versions, so this may not help you in accomplishing your goals.

--
Matt Berther
http://www.mattberther.com
How can i get html generated by a web server control in
the code behid page itself.
i want to store the html in some variable for some
purpose. is it possible.

Nov 19 '05 #3
Try this code:

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

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"vikram" <an*******@discussions.microsoft.com> wrote in message
news:20****************************@phx.gbl...
How can i get html generated by a web server control in
the code behid page itself.
i want to store the html in some variable for some
purpose. is it possible.

Nov 19 '05 #4

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

Similar topics

1
by: Ralph Krausse | last post by:
I know more html is needed to really produce this but enough is here for me to ask my question. So, this HTML code produce 2 buttons. One button is a HTML control and the other is ASP Web or Server...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
4
by: clintonG | last post by:
Technically speaking, this issue is not about modifying the HTML generated by server controls but preceding the HTML generated by server controls with an HTML control generated on the basis of the...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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.