Solution :
Whenever, you use textarea control in your html code, and you try to fetch the textarea data using jquery, you will encounter this 'unterminated string literal' issue.
Main reason of this issue is, while entering text in textarea control, if you press enter for new line, thus newline character is created, which make this issue to happen.
Please read below to find the solution to this issue,
suppose your html code is
HTML Code
<tr>
<td align="right">
About RJ :
</td>
<td align="left">
<asp:TextBox ID="txtaboutrj" runat="server" TextMode="MultiLine" Width="300" Height="100"></asp:TextBox>
</td>
</tr>
To avoid this issue to happen, what you have to do is, just append '.ToString().Replace(Environment.NewLine, "<br />")' to your control name in code behind, like shown below.
CodeBehind Code
txtaboutrj.Text.ToString().Replace(Environment.NewLine, "<br />")
This will replace newline character with HTML tag "<br />",
Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Indianic Infotech Ltd (India)
rajesh@indianic.com
1 comment :
Exactly what I needed.
Thank you!
Post a Comment