Reputation: 66
I am setting value of hiddenfield from code behind in vb.net
If(condition)
hdmodulename.Value =Dt_Module.DefaultView(0).Item("vModuleCode").ToString() +
"-" + Dt_Module.DefaultView(0).Item("vModuleName").ToString()
Else
hdmodulename.Value = hdmodulename.Value + "'\n'" + Dt_Module.DefaultView(0).Item("vModuleCode").ToString() + "-" + Dt_Module.DefaultView(0).Item("vModuleName").ToString()
End If
now alert in javascript i code like below:
alert('You cannot select ' + document.getElementById('<%=hdmodulename.ClientID%>').value);
Output :
'\n' is printed inseted of new line
so what is the probem?? Thanks A ton in advance
Upvotes: 0
Views: 204
Reputation: 15923
As for web pages, break lines with <br>
or <p></p>
tags. You can also Use Environment.NewLine
with VB.
For JS use \n' for the line break -
alert("some text\nmore text in a new line");
Upvotes: 1
Reputation: 2748
Please try with Environment.NewLine for VB.net
as below:
Dim value As String = "[First" + _
Environment.NewLine + _
"Second]"
will return
[First
Second]
Upvotes: 0
Reputation: 875
Not a vb expert, but shouldn't it be "\n" instead of "'\n'"? The one in the vb code have both double and single.
Upvotes: 0