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>
    --------------------------------------------------------------------------------------------------------------

  • 相关阅读:
    Method总结
    使用CSS的五种方式
    debug js code
    Overload
    fiddler模拟弱网测试
    POJ 1753 Flip Game (IDA*)
    UVA 11400 Lighting System Design(照明系统设计)(dp)
    UVA 12563 Jin Ge Jin Qu hao(劲歌金曲)(01背包+滚动数组)
    UVA 116 Unidirectional TSP (单向TSP)(dp多段图的最短路)
    UVA 1151 Buy or Build (买还是建)(并查集+二进制枚举子集)
  • 原文地址:https://www.cnblogs.com/blogLYF/p/3951419.html
Copyright © 2011-2022 走看看