0

site.master でハッチングされた変数 option_name が必要です。

サイトマスター

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>
       <% here!!!! %>
        <asp:ContentPlaceHolder ID="TitleContent" runat="server" />
    </title>
</head>
<body>
</body>
</html>

Configs.cs

[Table(Name = "Site_Config")]
public class Configs
{
    [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
    public int ID_option { get; set; }
    [Column]
    public string option_name { get; set; }
    [Column]
    public string option_title { get; set; }
    [Column]
    public string option_value { get; set; }
}

変数値を挿入したいコードを書きました。「インデックス」ビューを使用する方法は知っていますが、すべてのページに値を表示したい

4

1 に答える 1

0

option_name パラメータを ViewBag オブジェクトに入れて、マスター ページに表示できます。ViewBag オブジェクトの使用に関する詳細はこちら

于 2012-07-06T11:24:45.150 に答える