zoukankan      html  css  js  c++  java
  • LYF模板连接.txt

    在解决方案里创建了一个新建网站,在其右键下添加一个模板后,
    准备使用模板的,在添加新建项里突然没有“使用模板页的web窗体”,
    顿时感觉悲剧。。。

    解决方法:
    模板页代码---LYFMaterPage.Master--------------------------------------------------------------------------------
    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="LYFMaterPage.master.cs" Inherits="WebApplication1.LYFMaster.LYFMaterPage" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="headScriptLYF" runat="server">
    </asp:ContentPlaceHolder>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

    </asp:ContentPlaceHolder>
    </div>
    </form>
    </body>
    </html>
    模板页后台代码---LYFMaterPage.Master.cs---------------------------------------------------------------------------------
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace WebApplication1.LYFMaster
    {
    public partial class LYFMaterPage : System.Web.UI.MasterPage
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    }
    }
    模板页设计代码-------------------------------------------------------------------------------------------------------
    //------------------------------------------------------------------------------
    // <自动生成>
    // 此代码由工具生成。
    //
    // 对此文件的更改可能会导致不正确的行为,并且如果
    // 重新生成代码,这些更改将会丢失。
    // </自动生成>
    //------------------------------------------------------------------------------

    namespace WebApplication1.LYFMaster {


    public partial class LYFMaterPage {

    /// <summary>
    /// headScriptLYF 控件。
    /// </summary>
    /// <remarks>
    /// 自动生成的字段。
    /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
    /// </remarks>
    protected global::System.Web.UI.WebControls.ContentPlaceHolder headScriptLYF;

    /// <summary>
    /// form1 控件。
    /// </summary>
    /// <remarks>
    /// 自动生成的字段。
    /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
    /// </remarks>
    protected global::System.Web.UI.HtmlControls.HtmlForm form1;

    /// <summary>
    /// ContentPlaceHolder1 控件。
    /// </summary>
    /// <remarks>
    /// 自动生成的字段。
    /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
    /// </remarks>
    protected global::System.Web.UI.WebControls.ContentPlaceHolder ContentPlaceHolder1;
    }
    }
    -----------------------------------------------------------------------------------------------------------------
    网页代码---WebForm1.aspx---------------------------------------------------------------------------------------------
    <%@ Page Title="" Language="C#"
    MasterPageFile="~/LYFMaster/LYFMaterPage.Master" 此句就是当前网页使用的模板
    AutoEventWireup="true"
    CodeBehind="WebForm1.aspx.cs"
    Inherits="WebApplication1.LYFwebPage.WebForm1" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="headScriptLYF" runat="server">
    注意: ContentPlaceHolderID="headScriptLYF" 的值就是模板页中ID的值
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    </asp:Content>
    --------------------------------------------------------------------------------------------------------------

  • 相关阅读:
    bootstrap
    jQuery-介绍 加载 选择器 样式操作 属性操作 绑定click事件
    javascript -- BOM,DOM
    前端 -- javas-基本语法/引用等
    fatal: remote origin already exists.报错
    git
    npm install 时总是报phantomjs-prebuilt@2.1.14安装失败
    JavaScript中设置元素class,添加/删除元素class的方法
    单选按钮点击相关文字选中
    JS/Jquery实现select选中option触发事件
  • 原文地址:https://www.cnblogs.com/blogLYF/p/3951419.html
Copyright © 2011-2022 走看看