ASP.Net站点无法正确显示从VS 2010到VS 2013 Ultimate

时间:2014-05-08 04:56:07

标签: c# asp.net visual-studio-2010 visual-studio-2013

我在运行VS安装时在浏览器中查看Asp.Net站点时遇到了一个非常奇怪的问题。当我尝试在包含一些UpdatePanel控件的表上添加RadioButtonList时,似乎已经发生这种情况,以防止它们闪烁。

当我使用VS 2010在默认浏览器中查看网站中的特定页面时,说... BuildIt.aspx,该页面显示出来,我可以看到我对该页面的背景,是一个图像解决方案。我把它连接在CodeBehind中就像这样:

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Build_It : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder script = new StringBuilder();
        script.Append("<script type=\"text/javascript\">");
        script.Append("document.body.style.background = \"url('/Cyber7th/Images/BlueprintBuilder1.jpg')\";");
        script.Append("document.body.style.backgroundRepeat = 'no-repeat';");
        script.Append("</script>");

        this.ClientScript.RegisterClientScriptBlock(this.GetType(), "changeBackground", script.ToString());
    }        
}

这允许背景图像在导航时随关联页面而变化。这只适用于VS 2010.但是,当在VS 2013中试图添加AJAX控件来停止闪烁时,我的实现没有产生预期的结果,所以我删除了它。但是,现在当我使用VS 2013在默认浏览器中运行相同的页面时,我的背景图像不存在!这怎么样?以下是该页面的CodeBehind via VS 2013的相同代码:

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Build_It : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder script = new StringBuilder();
        script.Append("<script type=\"text/javascript\">");
        script.Append("document.body.style.background = \"url('/Cyber7th/Images/BlueprintBuilder1.jpg')\";");
        script.Append("document.body.style.backgroundRepeat = 'no-repeat';");
        script.Append("</script>");

        this.ClientScript.RegisterClientScriptBlock(this.GetType(), "changeBackground", script.ToString());
    }        
}

没有区别!为什么VS 2013拒绝显示页面的背景图像(在ASCX控件的两个页面上缺失),当后面的代码没有任何变化会影响这个?我甚至复制了工作解决方案中的代码。感谢您的帮助和见解。

1 个答案:

答案 0 :(得分:0)

我决定通过简单地重新安装整个程序来解决这个问题。成功。