【问题标题】:ASP.Net Site Not Displaying Properly from VS 2010 to VS 2013 Ultimate从 VS 2010 到 VS 2013 Ultimate 的 ASP.Net 站点无法正确显示
【发布时间】:2014-05-08 04:56:07
【问题描述】:

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

当我使用 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 在默认浏览器中运行同一页面时,我的背景图像不存在!这怎么样?这是通过 VS 2013 为页面的 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 2013 拒绝显示页面的背景图像(缺少两个作为 ASCX 控件的页面),而背后的代码中不存在应该影响这一点的更改?我什至从工作解决方案中复制了代码。感谢您的帮助和洞察力。

【问题讨论】:

  • “默认浏览器”是什么意思?是页面检查器吗?确保您在同一个浏览器中查看您的应用程序。
  • 当您选择在您选择的浏览器(Chrome、Firefox、Internet Explorer 或内部浏览器)中查看页面时。在编辑其中一个页面上的一些代码并放弃这些更改之后,VS 2013 没有显示我特定页面的背景图像。
  • 我想知道重新安装程序是否是一个简单的解决方法。

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-22
    • 2014-07-03
    • 2014-05-03
    • 2011-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多