asp.net高级应用之GridView控件
2011-11-23 18:03
441 查看
当使用数据源控件作为Gridview的数据源时,需要使用GridView的
DataSourceID属性来指定
并且不需要调用DataBind方法
GridView控件自定义列知识点
如何为删除按钮增加提示及如何访问GridView中的数据
protected void GridView1_RowDataBound(object sender,GridViewRowEventArgs e)
{
if(e.Row.RowType.RowType!=DataControlRowType.DataRow)
return;
LinkButton lbtn=e.row.Cell[7].Controls[0] as LinkButton;
//除模板列之外的特殊列,使用单元格的Controls集合去访问
string sid=e.Row.Cells[0].Text;
//普通绑定列,通过单元格的Text去访问
Image img=e.Row.Cells[5].FindControl("Image1") as Image; //适合在模板列中查找
if(lbtn!=null)
lbtn.Attributes.Add("onclick","return confirm('确定要删除吗?')")
}
DataSourceID属性来指定
并且不需要调用DataBind方法
GridView控件自定义列知识点
如何为删除按钮增加提示及如何访问GridView中的数据
protected void GridView1_RowDataBound(object sender,GridViewRowEventArgs e)
{
if(e.Row.RowType.RowType!=DataControlRowType.DataRow)
return;
LinkButton lbtn=e.row.Cell[7].Controls[0] as LinkButton;
//除模板列之外的特殊列,使用单元格的Controls集合去访问
string sid=e.Row.Cells[0].Text;
//普通绑定列,通过单元格的Text去访问
Image img=e.Row.Cells[5].FindControl("Image1") as Image; //适合在模板列中查找
if(lbtn!=null)
lbtn.Attributes.Add("onclick","return confirm('确定要删除吗?')")
}
相关文章推荐
- ASP.NET高级应用GridView控件
- asp.net高级应用之GridView控件(2)
- ASP.NET中Gridview控件高级技巧详细分析
- ASP.NET 2.0中使用Gridview控件的高级技巧
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET 2.0中Gridview控件高级技巧
- 来源:天极网 作者:高义 Public: 2006-08-19 ASP.NET 2.0 GridView控件应用模版
- ASP.NET 2.0中Gridview控件高级技巧
- asp.net高级应用之站点导航SiteMapPath控件
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET中Gridview控件高级技巧详细分析
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET 2.0中Gridview控件高级技巧 (转贴)
- ASP.NET高级应用之 (站点导航SiteMapPath控件)
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET 2.0中Gridview控件高级技巧