zoukankan      html  css  js  c++  java
  • 转asp.net中的App_GlobalResources和App_LocalResources使用

    asp.net中的App_GlobalResources和App_LocalResources使用

    App_GlobalResources是全局资源文件夹,主要存放一些所有页面都需要用到的信息。App_LocalResources是本地资源文件夹,主要存放的是该页面所要用到的字符串和信息。

    首先我们来看一下在VS中怎么创建和使用全局资源和本地资源,首先打开VS,新建一个网页项目,然后在单击该网站项目,然后单击右键,新建文件夹App_GlobalResources和App_LocalResources

    然后在App_GlobalResources,点击右键添加新项, Default.aspx .resx

    然后怎么使用该资源呢?注意看Text中的代码

    <form id="form1" runat="server">
    <div>
    <%-- <asp:Label ID="Label1" runat="server" Text="<%$ Resources:age %>"></asp:Label>--%>
    <asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:Default.aspx,name%>" />
    <asp:Literal ID="Literal2" runat="server" Text="<%$ Resources:Default.aspx,age%>" />


    </div>
    </form>
    创建本地资源和创建全局资源是一样的,但是创建本地资源的名字是用该页的页面名来命名的,如index.aspx,则在本地资源中新建的资源为index.aspx.resx。

    如何使用本地资源呢?使用本地资源的方式有两种。看如下代码

    <form id="form1" runat="server">
    <div>
    <asp:Literal ID="literal1" Text="<%$ Resources:titile %>" runat="server"></asp:Literal>
    <asp:Button ID="btnsubmit" meta:resourcekey="btnsubmit" runat="server" />
    </div>
    </form>

    http://www.tuicool.com/articles/MFBVRr

  • 相关阅读:
    Ansys Maxwell2——二维电磁场理论和有限元基础
    Ansys Maxwell在工程电磁场中的应用1——二维分析技术
    第四章 栈
    第三章 链表
    第二章 队列
    第三章 操作系统用户界面总结
    第一章 逻辑结构与物理结构
    Linux-Mint的一些配置经验
    docker安装zookeeper的使用说明
    SpringCloud初体验-使用Eureka进行服务注册和发现
  • 原文地址:https://www.cnblogs.com/yuhuameng/p/5096543.html
Copyright © 2011-2022 走看看