我正在从web方法加载asp.net用户控件。但是在使用Firebug或Chrome进行调试时,javascript不再有任何换行符。有没有办法保留换行符?
[WebMethod]
public static string LoadUserControl(string message)
{
using (Page page = new Page())
{
UserControl userControl = (UserControl)page.LoadControl("Message.ascx");
(userControl.FindControl("lblMessage") as Label).Text = message;
page.Controls.Add(userControl);
using (StringWriter writer = new StringWriter())
{
page.Controls.Add(userControl);
HttpContext.Current.Server.Execute(page, writer, false);
return writer.ToString();
}
}
}