DataView,Repeater,模板
2009-07-15 00:10
211 查看
1.DataView 的作用
可以公开表中具有不同的排序顺序的数据
mydv.Sort=" fbane Asc,fid Asc"
可以按行状或基于筛选器表达式来筛选数据
mydv/RowFilter=" num>100"
设置背景:
if(e.Row.Rowtype==DataControlRowType.DataRow)
{
e.Row.Attributes.add("onmouseover","currentcol=this.style.background='#coc0ff';this.style.cursor='hand'")
e.Row.Attributes.add("onmouseover","currentcol=this.style.background='#cocfff';this.style.cursor='hand'")
}
设置单元格的背景色:
e.Row.Cells[0]. BackColor=System.Drwaing.Color.Red;
2.DataGrid 读取xml中的数据
FileStream fs=new FileStream (Server.MapPath("Student.xml"),FileMode.Open,FileAccess.Read);//文件流
StreamReader st=new StreamReader (fs);//基于文件流读取纯文本(xml就是纯文本)
DataSet set=new DataSet ();
set.ReadXml(st); //将xml数据读入dataset中形成一个表
this.GridView1.DataSource=set;
this.GridView1.DataBind();
3.可绑定的数据类型
简单属性
<%# Textname.text%> 绑定表达式 服务端运行
集合
表达式
方法调用结果
4.模板(注意运用于DataGrid,DataList,Repeater)
设置属性 ,使用样式
模板是一组html元素和控件,他们构成组件特定部分的布局
Repeater(循环显示数据)
支持的模板 ItemTemplate(项) , Alternatingitemtemplate(交替),Headertemplate
Footertemplate,Separatortemplate(分割)
可以公开表中具有不同的排序顺序的数据
mydv.Sort=" fbane Asc,fid Asc"
可以按行状或基于筛选器表达式来筛选数据
mydv/RowFilter=" num>100"
设置背景:
if(e.Row.Rowtype==DataControlRowType.DataRow)
{
e.Row.Attributes.add("onmouseover","currentcol=this.style.background='#coc0ff';this.style.cursor='hand'")
e.Row.Attributes.add("onmouseover","currentcol=this.style.background='#cocfff';this.style.cursor='hand'")
}
设置单元格的背景色:
e.Row.Cells[0]. BackColor=System.Drwaing.Color.Red;
2.DataGrid 读取xml中的数据
FileStream fs=new FileStream (Server.MapPath("Student.xml"),FileMode.Open,FileAccess.Read);//文件流
StreamReader st=new StreamReader (fs);//基于文件流读取纯文本(xml就是纯文本)
DataSet set=new DataSet ();
set.ReadXml(st); //将xml数据读入dataset中形成一个表
this.GridView1.DataSource=set;
this.GridView1.DataBind();
3.可绑定的数据类型
简单属性
<%# Textname.text%> 绑定表达式 服务端运行
集合
表达式
方法调用结果
4.模板(注意运用于DataGrid,DataList,Repeater)
设置属性 ,使用样式
模板是一组html元素和控件,他们构成组件特定部分的布局
Repeater(循环显示数据)
支持的模板 ItemTemplate(项) , Alternatingitemtemplate(交替),Headertemplate
Footertemplate,Separatortemplate(分割)
相关文章推荐
- 如何使用动态创建模板列并绑定数据(GridView,Repeater,DataGrid)
- 小技巧在Repeater控件中找到对应模板内的控件
- 在DataList、Repeater的HeaderTemplate和FooterTemplate模板中寻找控件FindControl
- 自定义Repeater模板(原创)
- 动态创建Repeater模板
- 在DataList、Repeater的HeaderTemplate和FooterTemplate模板中寻找控件FindControl
- 在DataList、Repeater的HeaderTemplate和FooterTemplate模板中寻找控件FindControl
- 在一个repeater 中的模板列中的 button 如何能执行事件并且把所在行数据的ID读出来
- ASP.NET Repeater 头模板(HeaderTemplate)和FooterTemplate模板中查找控件
- 如何在Repeater的HeaderTemplate和FooterTemplate模板中寻找控件
- 在Repeater的HeaderTemplate和FooterTemplate模板中寻找控件
- 动态创建模板列并绑定数据(GridView,Repeater,DataGrid)
- 如何在Repeater的HeaderTemplate和FooterTemplate模板中寻找控件?
- Repeater获取HeaderTemplate和FooterTemplate模板中的控件
- 关于repeater内控件的事件绑定,内部模板列
- 扩展Repeater——让Repeater具有EmptyDataTemplate模板功能!
- repeater模板嵌套
- 如何在Repeater的HeaderTemplate和FooterTemplate模板中寻找控件?
- 获取控件Repeater、CreateUserWizard模板中的控件