Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Best way to dump HTML strings to a page in ASP.Net?

Reply
Thread Tools

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

 
 
mathewda@gmail.com
Guest
Posts: n/a
 
      06-28-2006
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!

 
Reply With Quote
 
 
 
 
sloan
Guest
Posts: n/a
 
      06-28-2006
asp:Literal


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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!
>



 
Reply With Quote
 
 
 
 
Dave Mathew
Guest
Posts: n/a
 
      06-28-2006
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
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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!
> >


 
Reply With Quote
 
Dave Mathew
Guest
Posts: n/a
 
      06-28-2006
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
> >
> >
> > <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed) 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!
> > >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dump complete java VM state as core dump (not via OS) possible? halfdog Java 12 02-21-2013 06:14 AM
How to dump a Python 2.6 dictionary with UTF-8 strings? W. Martin Borgert Python 3 01-12-2011 01:05 AM
Bug in the YAML library: #dump fails for certain multi-line strings John Trupiano Ruby 1 09-05-2008 05:02 PM
best efficient and readable way to concatenate strings (or the best trade-offs) Diego Martins C++ 5 06-19-2007 02:27 PM
Strings, Strings and Damned Strings Ben C Programming 14 06-24-2006 05:09 AM



Advertisments