|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Force multi line field value to output with line breaks?I have a field value that might look like this in the db
First Line Second Line Third Line When I query the data and output that data to a label in my gridveiw it looks like this: First Line Second Line Third Line How to I insert HTML formatting into the label text so it will render in the same fashion it was entered in the db? Or in other words, render with "<BR>" tags in place of the line breaks in the data? Thanks! B Hello again Bernie,
You can use Environment.NewLine with the Replace method like this: <asp:label runat="Server" ID="lblNotes" Text='<%# Eval("fldNodes").ToString().Replace(Environment.NewLine, "<br>") %>'></asp:label>Show quoteHide quote "bernadou" wrote: > I have a field value that might look like this in the db > First Line > Second Line > Third Line > > When I query the data and output that data to a label in my gridveiw it > looks like this: > First Line Second Line Third Line > > How to I insert HTML formatting into the label text so it will render in the > same fashion it was entered in the db? > > Or in other words, render with "<BR>" tags in place of the line breaks in > the data? > > Thanks! > B Phillip,
Once again you nailed it. I"ll give this a shot. Much appreciated. Show quoteHide quote "Phillip Williams" wrote: > Hello again Bernie, > > You can use Environment.NewLine with the Replace method like this: > > <asp:label runat="Server" ID="lblNotes" Text='<%# > Eval("fldNodes").ToString().Replace(Environment.NewLine, "<br>") > %>'></asp:label> > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "bernadou" wrote: > > > I have a field value that might look like this in the db > > First Line > > Second Line > > Third Line > > > > When I query the data and output that data to a label in my gridveiw it > > looks like this: > > First Line Second Line Third Line > > > > How to I insert HTML formatting into the label text so it will render in the > > same fashion it was entered in the db? > > > > Or in other words, render with "<BR>" tags in place of the line breaks in > > the data? > > > > Thanks! > > B
Itemtemplace and many to one dropdown example wanted
SelectedValue which is invalid Read underlying data in GridView row? Error: Multiple controls with the same ID '1' were found. Extracting values from child controls of a Repeater Reports and the ReportViewer GridView Data Binding at runtime Can't Create a multi page report Customise the SiteMapPath Control or use wild card URLs with a custom SiteMapProvider Design Time referencing of Properties |
|||||||||||||||||||||||