动态加载ASP用户控件会丢失javascript换行符

时间:2012-11-04 00:01:07

标签: javascript debugging

我正在从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();
        }
    }
}

0 个答案:

没有答案