I want a variable option_name hatched in site.master.
site.master
<%@ 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; }
}
I've written in the code where I wanted to insert a variable value. I know how to do through the "Index"-view, but I would like to display a value on all pages
You can put your option_name parameter into ViewBag object and display in on your master page. More info about using ViewBag object here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.