FormView和ListView的行数据读取分别在什么事件中.
2008-06-05 18:25
399 查看
cs代码:
1).FormView:
protected void plantForm_DataBound(object sender, EventArgs e)
{
FormView me = (FormView)sender;
//如果你要获取formview的数据.
// Part pt=(Part)me.DataItem;//Part是这个表的类.
if (me.DataItem != null)
{
if (!CanEditByMe)
{
ListView contactList = (ListView)me.FindControl("contactList");
contactList.InsertItemPosition = InsertItemPosition.None;
}
}
}
2). ListView:
protected void quotationList_ItemDataBound(object sender, ListViewItemEventArgs e)
{
ListViewDataItem item = (ListViewDataItem)e.Item;
Quotation quotation = (Quotation)item.DataItem; //获取当前行的数据.
//如果item.DataItem里的值和Quotation类里的值不是一一对应的.
// DataBinder.GetPropertyValue(item.DataItem,"Type").ToString() 这样就可以获取某个值了. //获取当前key.(int)me.DataKeys[e.ItemIndex].Value;
ITextControl litUpdateOn = (ITextControl)item.FindControl("litUpdateOn");
if (quotation.IsSubmitted)
{
if (quotation.UpdatedOn != null)
litUpdateOn.Text = Convert.ToDateTime(quotation.UpdatedOn).ToString("yyyy-MM-dd");
else
litUpdateOn.Text = "UpdateOn is null";
}
else
{
ViewState["IsSubmitted"] = "IsSubmitted";
litUpdateOn.Text = "Not Submitted";
}
}
1).FormView:
protected void plantForm_DataBound(object sender, EventArgs e)
{
FormView me = (FormView)sender;
//如果你要获取formview的数据.
// Part pt=(Part)me.DataItem;//Part是这个表的类.
if (me.DataItem != null)
{
if (!CanEditByMe)
{
ListView contactList = (ListView)me.FindControl("contactList");
contactList.InsertItemPosition = InsertItemPosition.None;
}
}
}
2). ListView:
protected void quotationList_ItemDataBound(object sender, ListViewItemEventArgs e)
{
ListViewDataItem item = (ListViewDataItem)e.Item;
Quotation quotation = (Quotation)item.DataItem; //获取当前行的数据.
//如果item.DataItem里的值和Quotation类里的值不是一一对应的.
// DataBinder.GetPropertyValue(item.DataItem,"Type").ToString() 这样就可以获取某个值了. //获取当前key.(int)me.DataKeys[e.ItemIndex].Value;
ITextControl litUpdateOn = (ITextControl)item.FindControl("litUpdateOn");
if (quotation.IsSubmitted)
{
if (quotation.UpdatedOn != null)
litUpdateOn.Text = Convert.ToDateTime(quotation.UpdatedOn).ToString("yyyy-MM-dd");
else
litUpdateOn.Text = "UpdateOn is null";
}
else
{
ViewState["IsSubmitted"] = "IsSubmitted";
litUpdateOn.Text = "Not Submitted";
}
}
相关文章推荐
- Android ListView从SQLLite中读取数据并显示,响应单击事件
- .NET 数据控件大全 GridView,DataList,DetailsView,FormView,ListView,Repeater,DataPager
- 第十五讲-----SimpleAdapter 封装复杂数据,ListActivity 类,ListView 事件,自动文本提示组件 AutoCompleteTextView
- ListView的数据绑定与点击事件读取信息
- Android自定义View(二)---拉刷新ListView 下之事件分发源码解析
- ListView中 item footerview headerview 的布局 事件监听等问题的收集整理
- 解决ListView+ViewPager滑动事件冲突的问题
- ExtJs4 笔记(11) Ext.ListView、Ext.view.View 数据视图
- RecyclerView展示固定数据、上拉加载更多、下拉刷新、点击事件、长按点击事件、删除条目、刷新条目、添加条目、多条目加载
- ExtJs4 笔记(11) Ext.ListView、Ext.view.View 数据视图
- 万能适配器和万能ViewHolder配合实现ListView列表数据展示
- C# 多线程读取数据并保存在DataGridView中,如果操作?代码是什么?谢谢
- 【Android】viewpager嵌套4个带侧滑的listview 事件冲突处理解决方案,可动态设置是否可以侧滑
- Android通过请求网络数据实现ListView,ListView的优化、图片的缓存、子控件的点击事件。
- ASP.NET FormView - 动态模版以及数据绑定到DynamicObject
- android从服务器端读取图片和数据混合流并显示在listview
- ASP.NET的五大数据控件(GridView,DataList,Repeater ,DetailsView,FormView)浅谈
- ListView与RecyclerView的区别 ? Recycler有什么优势 ?
- 分别设置listview加载中、空数据、加载数据失败三种状态的显示
- ListView中嵌套ViewPager滑动事件冲突