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 DetailsViewEval 和 Bind的区别1、Eval是单向的 Bind双向的2、Eval可以对数据格式化(Eval("PTime","{0:yyyy-MM}")),Bind不可以把普通页面变成内容页1、设置page指令的属性 Title MasterPageFile2、删除页面不需要的标签 <html> <head> <body> <form>3、添加<asp:content ....
转载于:https://www.cnblogs.com/eric-gms/p/3470688.html