GridView使用一些记录
2006-06-30 10:45
399 查看
现在有个项目开始使用ASP.NET 2.0开发,在开发过程中关于GridView的使用的一些零星的记录
1.TemplateField中的绑定
<asp:TemplateField>
</asp:TemplateField>
2.通过CheckBox得到选择行的主健值(GridView支持多主健)
private string GetSelectId()
private void TemplateColumn(GridView gvlist, string column, GridListAttribute att)
ColumnTemplate类
public class ColumnTemplate : ITemplate
//第一个模板列
public void InstantiateIn(Control container)
LiteralControl l = new LiteralControl();
l.DataBinding += new EventHandler(this.OnDataBinding);
container.Controls.Add(l);
}
public void OnDataBinding(object sender, EventArgs e)
LiteralControl lt = (LiteralControl)sender;//LiteralControl发送绑定请求
GridViewRow container = (GridViewRow)lt.NamingContainer;
lt.Text = DataBinder.Eval(container.DataItem, column).ToString();
}
}
1.TemplateField中的绑定
<asp:TemplateField>
</asp:TemplateField>
2.通过CheckBox得到选择行的主健值(GridView支持多主健)
private string GetSelectId()
private void TemplateColumn(GridView gvlist, string column, GridListAttribute att)
ColumnTemplate类
public class ColumnTemplate : ITemplate
//第一个模板列
public void InstantiateIn(Control container)
LiteralControl l = new LiteralControl();
l.DataBinding += new EventHandler(this.OnDataBinding);
container.Controls.Add(l);
}
public void OnDataBinding(object sender, EventArgs e)
LiteralControl lt = (LiteralControl)sender;//LiteralControl发送绑定请求
GridViewRow container = (GridViewRow)lt.NamingContainer;
lt.Text = DataBinder.Eval(container.DataItem, column).ToString();
}
}
相关文章推荐
- GridView使用一些记录
- Svn一些使用记录
- PlayFramework1.2.4 一些使用中的记录2(多文件上传)
- 使用XML记录数据的一些体会
- tcpdump抓包,然后使用tcpreplay进行回放,出现了一些问题,目前找不到答案,暂时先记录在这里
- 使用dwz一些记录
- 清除(设置)eclipse的workspace记录在使用eclipse进行开发的时候,首先要选择workspace。 一些workspace是不会再被使用的,可是switch workspace时它
- 关于使用webview的一些记录
- [Linux] Linux使用中的一些记录
- 有关 pullToRefreshListView 的一些使用做一下记录
- autolayout使用中的一些坑记录
- 使用Gridview插入新记录!!
- 【转】在vs中使用ZedGraph控件的一些记录
- mac上使用终端的一些记录文本
- 一些docker使用的相关记录
- 记录一些容易忘记的ThinkPHP使用技巧
- 学习Java中使用Netbeans的一些记录
- 关于cloudstack 个人使用的一些经验记录
- gridView的一些使用总结
- 对Shanty-Mongo使用过程的一些记录