zoukankan      html  css  js  c++  java
  • asp.net 服务器控件

    html的
        相对路径   ../返回上一级目录   ./和  当前目录
        根路径       /     返回的就是  http://域名/(不会判断是否有虚拟目录)路径
        绝对路径

    asp.net 中的根路径  ~/

    基本属性
        ClientID    $("#<%= txt.ClientID %>")
        Visible   false 不输出html
        CssClass
        Attributes
    基本控件
        Label
        Literal
        TextBox        AutoPostBack=true
        Button LinkButton ImageButton    //OnClientClick CommandName CommandArgument
        HyperLink
        Panel
        FileUpload
        Image
    数据源控件    ObjectDataSource
    数据绑定控件
        1/手工绑定    DataSource   DataBind()
        2/使用数据源控件

        DropDownList
            DataTextField
            DataValueFiled


        Repeater --不输出任何标签。 可以使用repeater输出rss
            ItemCommand
                1/设置按钮的属性
                2/写事件
                3/判断CommandName
            ItemDataBound  每一项绑定完成后触发
        

        ListView --不输出任何标签,必须设置模板
            可以实现增删改查,本身不具备分页功能,可以使用DataPager控件实现分页
            删除的时候
                1/让数据源的DeleteMethod调用Delete(Photo photo)
                2/设置ListView的DataKeyNames属性为主键

        
        *ObjectDataSource 高效分页
            1、查询共多少条数据GetCount()  返回int
            2、查询第几页的数据GetPaged(int startIndex,int pageSize) 返回泛型集合
                pageIndex  当前页第一条数据的num - 1
                pageSize  每页几条数据
                select * from (select *,row_number() over(order by pid desc) as num from photos) as t where num > @startIndex and num<= @startIndex +@pageSize  order by pid desc

                    第一页  每页3条
                    startIndex 0  
                    num > 0  and  num <= 0 + 3    

                    num > 3 and num <= 3+3                

            3、选择ObjectDataSource的SelectMethod属性 =GetPaged
            4、在页面上,把ObjectDataSource生成的参数删除
                <asp:Parameter Name="pageIndex" Type="Int32" />
                <asp:Parameter Name="maxRow" Type="Int32" />
            5、设置ObjectDataSource的属性
                EnablePaging = true
                MaximumRowsParameterName = pageSize
                StartRowIndexParameterName = pageIndex
                SelectCountMethod = GetCount
            6、可以设置DataPager的控件PageSize属性(每页几条数据)
        GridView
        DetailsView

    Eval 和 Bind的区别
    1、Eval是单向的  Bind双向的
    2、Eval可以对数据格式化(Eval("PTime","{0:yyyy-MM}")),Bind不可以



    把普通页面变成内容页
    1、设置page指令的属性 Title   MasterPageFile
    2、删除页面不需要的标签 <html> <head> <body> <form>
    3、添加<asp:content ....

  • 相关阅读:
    剑指Offer-合并两个排序的链表
    1. Two Sum&&15. 3Sum&&18. 4Sum
    Sumo生成数据
    357. Count Numbers with Unique Digits
    553. Optimal Division
    147. Insertion Sort List
    24. Swap Nodes in Pairs
    【LeetCode & 剑指offer刷题】发散思维题3:62 圆圈中最后剩下的数字(约瑟夫环问题)
    【LeetCode & 剑指offer刷题】发散思维题2:43 n个骰子的点数
    【LeetCode & 剑指offer刷题】发散思维题1:17 打印从1到最大的n位数
  • 原文地址:https://www.cnblogs.com/eric-gms/p/3470688.html
Copyright © 2011-2022 走看看