更新母版页控件后页面丢失CSS样式



ASP.3.5 No AJAX

母版页有一个外部样式表。在顶部有两个下拉列表。

插入新项时,将向每个下拉列表添加一个值。新添加的值必须在下拉列表中选择。

我从我的内容页更新了母版页上的下拉列表。下拉列表得到正确更新,但我失去了CSS样式。

这是我的主页。aspx代码

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>My Project</title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>

这是我的内容页代码:

protected void formview_ItemInserted(object sender, FormViewInsertedEventArgs e)
{
    if (e.Exception == null)
    {
        //Force the dropdownlistboxes in the master page also selects the newly inserted First
        DropDownList ddlFirst = Master.FindControl("ddlFirst") as DropDownList;
        if (ddlFirst != null)
        {
            ddlFirst.DataBind();
            Response.Write(ddlFirst.SelectedValue = Session["sFirstID"].ToString());
        }
        DropDownList ddlSecond = Master.FindControl("ddlSecond") as DropDownList;
        if (ddlSecond != null)
        {
            ddlSecond.DataBind();
            Response.Write(ddlSecond.SelectedValue = Session["sSecondID"].ToString());
        }
    }
}

我做错了什么?

试一下

<link rel="Stylesheet" href="StyleSheet.css" />

最新更新