jbajaj
asked on
"Multiline Textbox input to database and display in html""wrap problem
i have one form in which i m using multiline textbox and entering data in it with line break . this multi line textbox has wrap property true and fixed width so when i m adding data in textbox it automatically wrap but when i m displaying data on aspx form it will not wrap as well as break line it will display as continuos text
<asp:textbox id="txtdetail" runat="server" wrap="true" width="220px"/>
in cs file
database input txtdetail.text
form display
<div style="widht:220px;display :block;ove rflow:hidd enl">
<%# DataBinder.Eval(Container. DataItem, "Description")%>
</div>
please help me to solve this issue
<asp:textbox id="txtdetail" runat="server" wrap="true" width="220px"/>
in cs file
database input txtdetail.text
form display
<div style="widht:220px;display
<%# DataBinder.Eval(Container.
</div>
please help me to solve this issue
ASKER
yes GiftsonDJohn:
but when i replace /n by </br> breakline work but wrap will not work so when i do this my div text will overflow i need this text should display in my fixed width div if text line increase it should come in next line
<div style="widht:220px;display :block;ove rflow:hidd enl">
<%# DataBinder.Eval(Container. DataItem, "Description").ToString(). Replace("\ n","<br/>" ).Replace( "\r","<br/ >")%>
</div>
but when i replace /n by </br> breakline work but wrap will not work so when i do this my div text will overflow i need this text should display in my fixed width div if text line increase it should come in next line
<div style="widht:220px;display
<%# DataBinder.Eval(Container.
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In textbox the wrap is done by a new line character (\r\n). But html doesn't understand the wrap by a new line char. It is doe by <br />. So you need to wrap by
<div style="widht:220px;display
<%# DataBinder.Eval(Container.
</div>
In certain cases the above will not work. The replacement is below
<div style="widht:220px;display
<%# DataBinder.Eval(Container.
</div>