控制器:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcApplication1.Models;
using System.ComponentModel.DataAnnotations.Schema;
namespace MvcApplication1.Controllers
{
public class studentsController : Controller
{
//
// GET: /students/
public ActionResult details()
{
int id = 16;
studentContext std = new studentContext();
student first = std.details.Single(m => m.RollNo == id);
return View(first);
}
}
}
Run Code Online (Sandbox Code Playgroud)
DbContext模型:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
namespace MvcApplication1.Models
{
public class studentContext : DbContext
{
public DbSet<student> details { get; set; …
Run Code Online (Sandbox Code Playgroud) 我有一个外部JavaScript和一个CSS文件.我不知道如何将此文件添加到我的页面.我正在为CT和PT使用DWT TBB.
我正在我的页面TBB中编写内部CSS以暂时获取输出.但我没有得到如何实现JavaScript.有人能帮助我吗?
我应该将这些文件作为组件并在我的页面上呈现它们吗?这是正确的方法吗?如果是,请告诉我要遵循的步骤.
我想开发一个实时聊天应用程序,以允许Web用户与客户服务或彼此聊天.
我有什么选择?
我想知道是否需要在页面上创建用户控件作为组件,如果是,请执行此操作.
对于我使用的组件渲染:
<!-- TemplateBeginRepeat name="Components" -->
<!-- TemplateBeginIf cond="ComponentTemplate == 'HomePageCT'" -->
@@RenderComponentPresentation()@@
<!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
Run Code Online (Sandbox Code Playgroud) 我为所有这些类别创建了不同的页面:书籍,手机,组合等.现在我想在所有页面中放置这种类型的导航菜单(如图所示),打开页面应突出显示相应的菜单链接.
我应该创建一个包含文本和链接的模式并使其成为多值的吗?那么我创建一个组件,最后在所有页面中渲染它们?
如果没有,请建议任何其他更好的方法.
我从SDL Tridion站点获取此代码,该站点与页面上的ASP.Net用户控件呈现相关.
我所了解的是body标签菜单,内容,搜索结果都是.ascx文件.但我不明白他们使用过的其他控件.任何人都可以解释这段代码吗?
<%@ Page Language="C#" %>
<html>
<head>
<title>
<tridion:content ExpectXmlContent="true" XPath="//tcm:Content/tridion:Content/tridion:title" runat="server"/>
</title>
<tridion:content templateuri="tcm:47-3016-32" runat="server"/>
<tridion:track runat="server" xpath="//tcm:Metadata/tridion:Metadata/tridion:category" pageuri="tcm:47-2966-64" />
<tridion:secure issecured="false" redirecturl="~/login/login.aspx" runat='server'/>
</head>
<body>
<tridion:menu menutype="topnav" runat="server"/>
<tridion:content templateuri="tcm:47-3052-32" runat="server"/>
<tridion:searchresults Category="Categories" templateuri="tcm:47-3058-32" runat="server"/>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我有一个模式"控件",其中有一个名为"tag"(文本类型)的字段.现在我已经使用此模式创建了一个组件,并将"tag"字段填充为:
<RegForm:MyRegisteration runat="server" />
Run Code Online (Sandbox Code Playgroud)
和更新的Web配置文件.
<add src="~/WebUserControl.ascx" tagName="MyRegisteration" tagPrefix="RegForm" />
Run Code Online (Sandbox Code Playgroud)
我已将组件添加到页面.
现在我想知道这是渲染控件的方法还是任何其他更好的方法.
我曾经写过
<asp:SiteMapPath ID="SiteMapPath1" Runat="server" />
Run Code Online (Sandbox Code Playgroud)
在我的.net应用程序中显示导航站点地图 breadcrumb.谁能告诉我如何在Tridion页面中使用这种功能?或者我应该将其用作用户控件并将其添加到我的页面?
还有一件事,你看到下载图片中的PDF链接.如何将此文本链接到放置在building block文件夹中的相应PDF文件?我应该写这样的文件(多媒体组件)的tcm id吗?
<a href="tcm id of file" > Download PDF </a>
Run Code Online (Sandbox Code Playgroud)
这是正确的做法吗?
我的选择:
在页面模板或CT中包含分析代码.
创建一个包含分析代码的组件,并在页面的Comonent表示中呈现它.
这可能会更好或请建议任何其他出路.
我已经有一个英文的 MVC 网站。现在我需要添加阿拉伯语。为此,我想使用下面的结构来存储我的本地化 .cshtml 文件
英文视图
~/Views/index.cshtml
~/Views/about.cshtml
阿拉伯语视图
~/ar/Views/index.cshtml
~/ar/Views/about.cshtml
英文 URL (It's working)
www.samplesite.com/home/index
www.samplesite.com/home/index
阿拉伯语 URL(不起作用)
www.samplesite.com/ar/home/index
www.samplesite.com/ar/home/index
如果 url 带有 /en 或没有语言参数,我需要返回英文视图,如果 URL 以 /ar 开头,我需要返回 ar/Views 文件夹中的视图。我应该在路由配置和操作中更改什么才能根据 URL 获得正确的视图?
我有一个站点地图的XML文件,这里是:
<?xml version="1.0" encoding="utf-8"?>
<siteMap>
<siteMapNode url="/" title="Home" tcmId="tcm:142-2-4">
<siteMapNode url="/controls" title="Controls" tcmId="tcm:142-1131-4" type="structure group" />
<siteMapNode url="/css" title="CSS" tcmId="tcm:142-1134-4" type="structure group" />
<siteMapNode url="/js" title="JS" tcmId="tcm:142-1133-4" type="structure group" />
<siteMapNode url="/xslt" title="XSLT" tcmId="tcm:142-1132-4" type="structure group" />
<siteMapNode url="/mobile" title="Mobile" tcmId="tcm:142-1165-4" type="structure group" />
<siteMapNode url="/mobilebiscuitml" title="Mobile BiscuitML" tcmId="tcm:142-1180-4" type="structure group" />
<siteMapNode url="/system" title="system" tcmId="tcm:142-136-4" type="structure group">
<siteMapNode url="/system/captcha" title="Captcha" tcmId="tcm:142-260-4" type="structure group" />
<siteMapNode url="/system/communicator" title="Communicator" tcmId="tcm:142-201-4" type="structure group" />
<siteMapNode url="/system/errorpages" title="Error Pages" tcmId="tcm:142-322-4" type="structure group" /> …
Run Code Online (Sandbox Code Playgroud)