Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which to use - label/panel or text box??

Status
Not open for further replies.

JulesBos

Programmer
Sep 6, 2006
68
US
Hi,

I've got a page that is used for printing purposes and has been formatted in a specific way. The page, on load, uses a datareader to get data from a back end db and populates the page. I've used labels and panels to account for the fact that the data will be of variable sizes. It all works fine except when the data is from a memo field and it has multiline info. Labels cannot display multiple lines so the data is all concatenated which is not what my users want.

I can't use panels, because you can't set panel text programatically and text boxes don't look right, and I'm not sure if it's possible to get them to stretch to the correct size to display all the text.

Has anyone any ideas on how best to achieve displaying multiline text?

Thanks

Julia
 
Use a placeholder, and then programatically add a literal control. Add the text to that. A Literal control renders as a div or span IIRC, so you can style the html with a css..
 
Labels cannot display multiple lines
Yes they can. Labels by default render as a span tag which is perfectly capable of displaying text on multiple lines.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Labels can display multiple lines? Wy don't mine then? Th data is coming from a back end Access database. Do I need to do anything special with it then? Here's the current code:

Code:
 Connection.Open()
        Dim datareader As OleDb.OleDbDataReader
        Dim SQLSelectString As String
        SQLSelectString = _
            "SELECT QuotePrintDetails.QuoteFromName, QuotePrintDetails.QuoteFromTitle, " + _
            "QuotePrintDetails.FAO, QuotePrintDetails.QuoteHeader, QuotePrintDetails.ELText, " + _
            "QuotePrintDetails.DelTermsText, QuotePrintDetails.Questions, " + _
            "QuotePrintDetails.Assumptions, QuotePrintDetails.FreeText, QuotePrintDetails.Phone, " + _
            "QuotePrintDetails.Fax, QuotePrintDetails.Email FROM QuotePrintDetails " + _
            "WHERE QuotePrintDetails.QuoteID=" + quoteRecordID
        DBCommand.commandtext = SQLSelectString
        datareader = DBCommand.ExecuteReader(CommandBehavior.CloseConnection)
        While datareader.Read
            Me.FromNameHeaderLabel.Text = datareader.GetValue(0)
            Me.FromTitleHeaderLabel.Text = datareader.GetValue(1)
            Me.Phone2HeaderLabel.Text = datareader.GetValue(9)
            Me.Fax2HeaderLabel.Text = datareader.GetValue(10)
          

etc
End While

 
Sorry to take a while to respond. Have been off work. Here's what the source for that particular field looks like:

Code:
<div id="AssumptionsHeaderPanel" style="font-family:Verdana;font-size:10pt;font-weight:bold;width:17cm;">
		ASSUMPTIONS
	</div>
                <div id="AssumptionsBodyPanel" style="font-family:Verdana;font-size:10pt;width:17cm;">
		
                    <span id="AssumptionsLabel" style="font-family:Verdana;font-size:10pt;">1 - you are nice
2 - we are fantastic</span>
                
	</div>
                <div id="AssumptionsBlankPanel" style="font-family:Verdana;font-size:10pt;height:16px;width:17cm;">

	</div>

There should be a line break after "1 - you are nice"

Thanks
Julia
 
There doesn't appear to be any html line breaks between that text. A line break in html is a <br> tag so you'll need to add one of those for it to break. If the data has been inserted with standard windows carriage returns and/or line breaks, you will have to do a replace on the string before you show it e.g.
Code:
myString.Replace(vbCrLf, "<br>")


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top