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

Best way to dump HTML strings to a page in ASP.Net?

I'm currently work'n on a project where I'm dynamically generating some
HTML as text into a string builder. My ASP page has a <span> tag on it
and after I gernerate HTML to my string builder I concat all the
strings and set the span's innerHTML property to this output. What I'm
wondering is if this is the best way to do this or is there a better
method to take a bunch of strings and dump them out onto an ASP page so
it shows up as formatted HTML? Second of all, this method seems to work
fine when my text has a lower number of strings, if I have a lot of
strings however it outputs to the page correctly but strangely enough
other portions of my page stop working (like my seach box will no
longer work, this only happens with a high number of strings being
concat'ed though, like 100+)? Any insights would be appreciated!

Jun 28 '06 #1
3 1960
asp:Literal
<ma******@gmail.com> wrote in message
news:11**********************@d56g2000cwd.googlegr oups.com...
I'm currently work'n on a project where I'm dynamically generating some
HTML as text into a string builder. My ASP page has a <span> tag on it
and after I gernerate HTML to my string builder I concat all the
strings and set the span's innerHTML property to this output. What I'm
wondering is if this is the best way to do this or is there a better
method to take a bunch of strings and dump them out onto an ASP page so
it shows up as formatted HTML? Second of all, this method seems to work
fine when my text has a lower number of strings, if I have a lot of
strings however it outputs to the page correctly but strangely enough
other portions of my page stop working (like my seach box will no
longer work, this only happens with a high number of strings being
concat'ed though, like 100+)? Any insights would be appreciated!

Jun 28 '06 #2
yeah, a literal seems to be a better way to go.

However, even after I switched it to that I'm still having problems
with how much HTML I'm allowed to post to the text property of the
literal. Is there some kinda of limit on how much data you can assign
to the text property?

Here's the specific effect I'm seeing.... I have a custom built seach
box which is simply a button and a text box which has an OnClick method
that uses Response.Redirect to redirect to a URL adding a query string.
On this results page I have a asp:Literal tag and I generate a bunuch
of HTML as strings into a string builder. After all my strings are
generated I say nameOfLiteral.Text = nameOfStringBuilder.ToString();
The page always shows the correct dynamically generated HTML so it
seems the data is getting into the text property of the Literal and
displayed on the page... however, when I don't have that much HTML
added to the Literal my search box works as normal, when I add much
more HTML to the literal control my search box stops working and
generates a scrip error in IE. So it seems as if the text is getting to
the literal ok but for some reason a lot of text as opposed to a little
breaks my page. Any suggestions on a fix for this?

sloan wrote:
asp:Literal
<ma******@gmail.com> wrote in message
news:11**********************@d56g2000cwd.googlegr oups.com...
I'm currently work'n on a project where I'm dynamically generating some
HTML as text into a string builder. My ASP page has a <span> tag on it
and after I gernerate HTML to my string builder I concat all the
strings and set the span's innerHTML property to this output. What I'm
wondering is if this is the best way to do this or is there a better
method to take a bunch of strings and dump them out onto an ASP page so
it shows up as formatted HTML? Second of all, this method seems to work
fine when my text has a lower number of strings, if I have a lot of
strings however it outputs to the page correctly but strangely enough
other portions of my page stop working (like my seach box will no
longer work, this only happens with a high number of strings being
concat'ed though, like 100+)? Any insights would be appreciated!


Jun 28 '06 #3
k, I got it figured out now, or at least a solution with a plausable
explaination. Thought I'd repost in case anybody else has this problem
in the future. I tried running my page in FireFox and it worked there
but not in IE. After a little research it seems that IE has different
limitations for query strings or hidden fields than other browers...
apparently FireFox supports more data than IE in this respect which
would explain why it worked in FireFox but not in IE. Because I was
using GET for the form method this also made a difference (again
seemingly a difference between browsers). By changing the the form
method to POST (which is generally used for larger amounts of data) the
problem was solved in IE. Moral of the story is that if there's a lot
of data being passed in a query string or hidden feild make sure your
form method is POST so it has more room to pass your data along.

Dave Mathew wrote:
yeah, a literal seems to be a better way to go.

However, even after I switched it to that I'm still having problems
with how much HTML I'm allowed to post to the text property of the
literal. Is there some kinda of limit on how much data you can assign
to the text property?

Here's the specific effect I'm seeing.... I have a custom built seach
box which is simply a button and a text box which has an OnClick method
that uses Response.Redirect to redirect to a URL adding a query string.
On this results page I have a asp:Literal tag and I generate a bunuch
of HTML as strings into a string builder. After all my strings are
generated I say nameOfLiteral.Text = nameOfStringBuilder.ToString();
The page always shows the correct dynamically generated HTML so it
seems the data is getting into the text property of the Literal and
displayed on the page... however, when I don't have that much HTML
added to the Literal my search box works as normal, when I add much
more HTML to the literal control my search box stops working and
generates a scrip error in IE. So it seems as if the text is getting to
the literal ok but for some reason a lot of text as opposed to a little
breaks my page. Any suggestions on a fix for this?

sloan wrote:
asp:Literal
<ma******@gmail.com> wrote in message
news:11**********************@d56g2000cwd.googlegr oups.com...
I'm currently work'n on a project where I'm dynamically generating some
HTML as text into a string builder. My ASP page has a <span> tag on it
and after I gernerate HTML to my string builder I concat all the
strings and set the span's innerHTML property to this output. What I'm
wondering is if this is the best way to do this or is there a better
method to take a bunch of strings and dump them out onto an ASP page so
it shows up as formatted HTML? Second of all, this method seems to work
fine when my text has a lower number of strings, if I have a lot of
strings however it outputs to the page correctly but strangely enough
other portions of my page stop working (like my seach box will no
longer work, this only happens with a high number of strings being
concat'ed though, like 100+)? Any insights would be appreciated!


Jun 28 '06 #4

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

Similar topics

0
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what...
6
by: Eric Robinson | last post by:
Our database just slowed down radically. Certain queries drive CPU utilization through the roof. This happened once before, and the technican simply dumped the data to disk and then played it back...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
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: Andrew | last post by:
Hi, friends, In ASP, we use obj = CreateObject("com.dll") obj.GetHTMLText(inVal, outHTMLTxt1, outHTMLTxt2) to get different HTML strings based on input values. Then, we insert them into...
4
by: Együd Csaba | last post by:
Hi, the restoration of a dump stops at the line above. The dump was created with pgsql 7.3.2 and I need to pump it into a 7.4.3 one. Should anybody tell me what the problem can be and how I can...
14
by: Sheldon | last post by:
Hi, I have a python script that uses a C extention. I keep getting a recurring problem that causes a core dump a few lines after the C extention return data back tp python. I tried using pbd and...
13
by: Justin.Voelker | last post by:
Hello Everyone: I am in search of an easier way to develop pages. My most current website, www.Base2WebDesign.com, has the exact same layout throughout the entire site. Right now I use a...
4
by: trullock | last post by:
Hi, Can anyone suggest the best way to go about the following... I'm tracking clicks (mouse down x,y coordinates) on a web page by using some javascript to create an XHR which sends the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
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: 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...

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.