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

  • 相关阅读:
    bug记录_signalr执行$.connnection.testhub结果为空
    mysql存储过程
    docker安装svn
    Redis在windows下安装过程
    JAVA日期查询:季度、月份、星期等时间信息
    VueX(Vue状态管理模式)
    Lambda常用写法
    Docker部署SpringBoot项目
    vue+nginx+docker 的前端项目部署方案
    docker常用操作
  • 原文地址:https://www.cnblogs.com/yuhuameng/p/5096543.html
Copyright © 2011-2022 走看看