I am creating a web page that will be printed.
Text is comming from SQL server varchar(xxx) fields.
The text was entered from asp.net textboxes.
The problem is I need to ensure all the text if visible on the page for
printing.
Solution1.
I put the text from the sql server in a textbox. There is one problem the
textbox does on auto size to display all the text. I can write some code to
try to calculate the number of rows in the text and set the multiline and
rows property to open the text box. This is not exact so some of the last
rows can be missing or there are extra blank lines in the textbox
Solution2.
Use a label or Div to display the text since they will autosize. the problem
with this is the line breaks do not work and all the text runs togeather.
The question is how can I display this text so it all displays. This site
does a good job of this. When I look at the page that displays when a post is
double clicked it has been formated and breaks have been inserted any hints
on how this is done.
Or is there a easer way
Thank you
Thank you
Hi Jerry,
Based on your description, I think the main problems here are the following
two:
1. to display the text on web page as expandable mode
2. preserve those line breaks in the text
For this issue, I think you can consider the following approach:
In ASP.NET web page, the output is html/xhtml in which line break is
different from normal text. In normal text, line break is \n or \r\n.
However, this is not the case in HTML, which use <br/> tag as line break.
Therefore, I suggest you use some additional code to do the replacement for
those text retrieved from database. The entire solution will be something
like this:
** first, retrieve the text from database, and do a string replacement on
the text(replace all the \n or \r\n with <br/>)
e.g.
=============
<ItemTemplate>
<%# ((string)Eval("field name")).Replace("\n", "<br/>") %>
</ItemTemplate>
===============
**display the text(after replacement) in a Label or <div>(which is
expandable)
Here are some web threads discussing on the same problem which has included
different kind of code examples:
http://www.codingforums.com/showthread.php?t=104153
http://www.mikesdotnetting.com/Article.aspx?ArticleID=20
http://forums.asp.net/p/1257227/2340359.aspx
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?SmVycnkgQw==?= <jerryed@nospam.nospam>
>Subject: auto expand for text in a web page
>Date: Fri, 20 Jun 2008 11:28:09 -0700
>I am creating a web page that will be printed.
>
[quoted text clipped - 24 lines]
>
>Thank you
Steven Cheng [MSFT] - 25 Jun 2008 09:57 GMT
Hi Jerry,
How are you doing?
Does the information in my last reply help you some? If there is anything
else we can help, welcome to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Date: Mon, 23 Jun 2008 04:07:03 GMT
>Subject: RE: auto expand for text in a web page
>Hi Jerry,
>
[quoted text clipped - 54 lines]
>Get notification to my posts through email? Please refer to
>http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif