2011-12-07 17 views
0

ASP.3.5いいえAJAXマスターページのコントロールを更新した後にCSSスタイルが失われるページ

マスターページには外部スタイルシートがあります。トップセクションには2つのドロップダウンリストがあります。

新しい項目が挿入されると、各ドロップダウンリストに値が追加されます。新しく追加された値は、ドロップダウンリストで選択する必要があります。

私のコンテンツページから、私はマスターページのドロップダウンリストを更新します。ドロップダウンリストは正しく更新されていますが、CSSスタイルが失われています。私は間違って何をやっている

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()); 
     } 

    } 
} 

は、ここに私のMasterpage.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> 

」私のコンテンツページのコードですか?

+0

はあなたが試すことができ: '<リンクのhref = "StyleSheet.css" のrel = "スタイルシート" タイプ= "テキスト/ CSSの">' P.S.なぜあなたは 'Response.Write'ですか? –

答えて

1

これを試してください。

<link rel="Stylesheet" href="StyleSheet.css" /> 
関連する問題