如何在母版页中使用样式表 [英] How to Style sheet use in Master Page

查看:139
本文介绍了如何在母版页中使用样式表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





这是我的代码..



链接文件显示错误无法嵌套元素'形式'



请帮助我...



Hi,

This is my code..

Link file shows error cannot be nested within element 'form'

please help me...

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ItemMaster.aspx.cs" Inherits="Master_ItemMaster" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>



<asp:Content ID="Content1" runat="server"

    contentplaceholderid="ContentPlaceHolder2">

<link rel="stylesheet" href="~/Styles/TabsStyle.css" type="text/css" />

<asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>

推荐答案

链接标签需要标签。所以

将一个持有人放在母版页的头标签内。

link tag require head tag.So
place a holder inside head tag in master page.
<head runat="server">

<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
    </asp:ContentPlaceHolder>





现在您的子页面有两个占位符





Now your child page have two place holders

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
      --your styles and scripts
</asp:Content>










<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

----your contents
</pre>


这篇关于如何在母版页中使用样式表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆