在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
By default, the template content of ASP.NET applications is provided by User Controls embedded into the DevExpress.ExpressApp.Web, and thus cannot be modified. However, you can include template content source files into your application project, modify this content and switch to it instead. This example demonstrates how to modify the DefaultVerticalTemplateContentNew template content. 默认情况下,ASP.NET应用程序的模板内容由嵌入到 DevExpress.ExpressApp.Web 中的用户控件提供,因此无法修改。但是,您可以将模板内容源文件包含在应用程序项目中,修改此内容并切换到它。此示例演示如何修改默认垂直模板内容新模板内容。
. Add an Editable Template添加可编辑模板Open the existing XAF solution or create a new one. Invoke the Template Gallery for the ASP.NET application project, choose the XAF ASP.NET Templates | Default Vertical Template Content project item and specify a name (e.g., "MyDefaultVerticalTemplateContent"). 打开现有的 XAF 解决方案或创建新的解决方案。调用ASP.NET应用程序项目的模板库,选择 XAF ASP.NET模板 |默认垂直模板内容项目项并指定名称(例如,"我的默认垂直模板内容")。
The following files that implement the User Control will be added.
将添加以下实现用户控件的文件。
These files are selected in the image below, which was taken from the Solution Explorer window. 这些文件在下图中选择,该图像取自"解决方案资源管理器"窗口。
Open the ASCX file. Here, you can modify the content markup. For instance, you can change the Update Panel style - replace its "4a4a4a" color with "2c86d3". 打开 ASCX 文件。在这里,您可以修改内容标记。例如,您可以更改"更新面板"样式 - 将其"4a4a4a"颜色替换为"2c86d3"。。 Use the Modified Template Instead of Default使用修改的模板而不是默认值To use the modified content instead of default content, open the Global.asax.cs (Global.asax.vb) file and modify the Session_Start event handler. Specify a path to your custom User Control as shown below. 要使用修改后的内容而不是默认内容,请打开Global.asax.cs (Global.asax.vb) 文件并修改Session_Start事件处理程序。指定自定义用户控件的路径,如下所示。 protected void Session_Start(Object sender, EventArgs e) { // ... WebApplication.Instance.Settings.DefaultVerticalTemplateContentPath = "MyDefaultVerticalTemplateContent.ascx"; WebApplication.Instance.SwitchToNewStyle(); WebApplication.Instance.Setup(); WebApplication.Instance.Start(); }
The image below illustrates the modified View caption style in the running application. 下图演示了正在运行的应用程序中修改的视图标题样式。
Add an Action Container to the Template将操作容器添加到模板The NavigationHistoryActionContainer, which displays the navigation history (breadcrumbs), is not available in the new web UI. However, you can easily add it to your custom ASP.NET template using the following markup. 显示导航历史记录(痕迹)的导航历史记录操作容器在新 Web UI 中不可用。但是,您可以使用以下标记轻松地将其添加到自定义ASP.NET模板。 ASPX <xaf:XafUpdatePanel ID="XafUpdatePanel3" runat="server"> <xaf:NavigationHistoryActionContainer runat="server" ContainerId="ViewsHistoryNavigation" id ="NavigationHistoryActionContainer" Delimiter=" / " /> </xaf:XafUpdatePanel>
The Action Container should be placed within the XafUpdatePanel control. The result is demonstrated below. 操作容器应放置在 XafUpdatePanel 控件中。结果如下。 You can use the same approach to add any other built-in or custom Action Container to a desired location within a Template. Note that your custom Action Container instance should be added to the list returned by the Template's IFrameTemplate.GetContainers method. 您可以使用相同的方法将任何其他内置或自定义操作容器添加到模板中的所需位置。请注意,自定义操作容器实例应添加到模板的 IFrameTemplate.GetContainers 方法返回的列表。 |
请发表评论