• ASP.NET前端语法应用


    字符拼接
    <%# "abc" + Eval("列名").ToString() %>
    <%# Eval("列名","abc{0}") %>
    格式化
    <%# Eval("列名"{0:yyy-MM-dd}") %> //日期格式化
    <%# Eval("价格"{0:000.0#}") %> //如果没三位就补0,如001,强制后一位小数 001.0
    调用函数
    <%# 函数(Eval("列名")) %>

    在当前位置输出表达式的值的时候使用<%=UserName %>,不要丢了=
    相当于当前位置调用 Response.Write(UserName)
    使用的函数,代码相当于在这个位置调用函数,执行代码
    注意 aspx中调用cs的成员级别必须是 protected 或者 public ,不能是 private

    aspx,cs,dll 之间的关系

    在 WebForm(CS文件) 中执行下面的代码
    Response.Write(this.GetType() + "<br/>"); //当前执行类的类型名
    Response.Write(this.GetType().Assembly.Location + "<br/>"); //当前类所在的Assembly(DLL文件)位置
    Response.Write(this.GetType().BaseType + "<br/>"); //当前对象父类的类型名
    Response.Write(this.GetType().BaseType.Assembly.Location + "<br/>"); //父类的 Assembly 位置

    使用 Reflector打开这个临时dll,反编译这两个类,发现 webform1 是在VS中编写的aspx.cs类
    而ASP.webform1_aspx则是一个继承 webform1的子类,ASP.webform1_aspx是根据aspx内容动态
    生成的构建内容的类。
    当前类是 webform1 ,执行后发现当前执行页面的类名是 ASP.webform1_aspx 这样的类名,父类才是 webform1
    说明ASP.webform1_aspx继承了 webform1,所以在 cs中设置成员级别为 private ,在子类中是不可以调用的

  • 相关阅读:
    .net 文件夹是否存在的判断
    Lock Statement And Thread Synchronization
    如何利用EnteLib Unity Interception Extension 和PIAB实现Transaction
    OSQL 命令行工具
    How to build tab sets whitch headers display at bottom in WPF?
    Monitoring Clipboard Activity in C#
    产品经理讲座的感悟
    图说
    解决技术问题的9点建议
    为啥要整理需求?
  • 原文地址:https://www.cnblogs.com/xgao/p/4173925.html
Copyright © 2020-2023  润新知