zoukankan      html  css  js  c++  java
  • MasterPage 的使用方法

    MasterPage 的几个知识点:
    1. 在母版页中的 ContentPlaceHolder ,相应的内容页显示为:Content
    2. 母版页与内容页的数据通信:每一个控件都得找,
    例如:((Label)Master.FindControl("label1")).Text ="MasterPage级别的:"+ DropDownList1.SelectedValue;
    前面的label1是 母版页中的, 后面的 DropDownList1 是在内容页中,这句代码是写在 内容页的 cs 文件中.
    3. 如果要改变 母版, 则应该在 内容页与母版页合并之前,改变母版页文件.方法如下
         MasterPageFile="~/TestMasterPage.master"
        过程是这样的:内容页根据页头的 MasterPageFile="~/TestMasterPage.master" 找到母版页后,再合并后在前台显示出来
         private void Page_PreInit(object sender,EventArgs e)
         {
             if (Session["jiao"] == "")
               { //切换 母版页 
                     Page.MasterPageFile = "/TestMasterPage.master"; 
               }
         }
    4.  母版页还可以镶嵌使用.这里没做.

    母版前台页面:  testMasterPage.master



    内容页前台:

    内容页后台:
  • 相关阅读:
    python运维之saltstack方式
    windows下使用vim
    django-redis中文文档
    Skipping GMP tests ([WinError 126] 找找不不到到指指定定的的模模块块。。)
    python pycryptodome库,及后台支付宝功能接入
    关于python时间相关的函数记录集合
    mysql练习题博客集
    mysql -uroot -p -P3306 -h192.168.0.111无法远程连接mysql
    报错 Storing debug log for failure in /root/.pip/pip.log
    多进程 库multiprocessing
  • 原文地址:https://www.cnblogs.com/gfwei/p/569208.html
Copyright © 2011-2022 走看看