472,793 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,793 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 1930
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.