Hi
I have below code but message is not getting displayed. I am trying to insert new line after each record
C#
StringBuilder sb = new StringBuilder();
foreach (var colum in Result)
{
sb.Append(" " + sr + ". " + colum.Name + " in Session : " + colum.SessionDeliveryNo + " dated : " + Convert.ToDateTime(colum.SessionDate).ToString("dd-MM-yyyy"));
sb.Append("\n");
sr++;
}
string s = sb.ToString();
s = s.Replace("'", "").Replace("/", " ").Replace(";", " ").Replace(":", " ").Replace(",", " ");
s= System.Text.RegularExpressions.Regex.Replace(s, @"\t|\r", " ");
if (Utility.IE(Request.Browser.Browser))
{
MessageBox.Show(s);
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + "Book has been read by : " + "', '" + s + "','" + "info" + "');", true);
}
function ShowPopup(heading, body, type) {
swalInit.fire({
title: heading,
text: body,
type: type,
position: 'top',
allowOutsideClick: false,
timer: 6000
});
}Thanks

Vishal YelveRank #178 · 13.6K reputationPosted Apr 4, 2023, 6:42 AM EDT
Hi Ramco,
tr this.
replace
sb.Append("\n");to
Ramco RamcoRank #462 · 5.4K reputationPosted Apr 4, 2023, 6:48 AM EDT
Hi Vishal
I have tried this. Below is the code. It display message but new line is not inserted
StringBuilder sb = new StringBuilder(); foreach (var colum in Result) { sb.Append(" " + sr + ". " + colum.Name + " in Session - " + colum.SessionDeliveryNo + " dated - " + Convert.ToDateTime(colum.SessionDate).ToString("dd-MM-yyyy")); sb.Append(Environment.NewLine); sr++; } string s = sb.ToString(); s = s.Replace("'", "").Replace("/", " ").Replace(";", " ").Replace(":", " ").Replace(",", " "); s= System.Text.RegularExpressions.Regex.Replace(s, @"\t|\n|\r", " "); if (Utility.IE(Request.Browser.Browser)) { MessageBox.Show(s); } else { ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + "Book has been read by : " + "', '" + s + "','" + "info" + "');", true); } **************************************************************************************** function ShowPopup(heading, body, type) { swalInit.fire({ title: heading, text: body, type: type, position: 'top', allowOutsideClick: false, timer: 6000 }); }Thanks