protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
LinkButton lbDeletes = (LinkButton)e.Row.Cells[0].FindControl("LinkButton2");
if (lbDeletes.Text.Equals("删除"))
{
lbDeletes.Attributes.Add("onclick", "javascript:return confirm('确认删除当前项吗?')");
}
老是提示未将对象引用设置到对象的实例!
编辑和删除都是在第0列
{
LinkButton lbDeletes = (LinkButton)e.Row.Cells[0].FindControl("LinkButton2");
if (lbDeletes.Text.Equals("删除"))
{
lbDeletes.Attributes.Add("onclick", "javascript:return confirm('确认删除当前项吗?')");
}
老是提示未将对象引用设置到对象的实例!
编辑和删除都是在第0列
解决方案 »
- 关于AspNetPager的Repeater分页问题
- 这个方法是怎样处理IP的???
- 菜鸟问题:经过身份验证的用户重定向回最初请求的 URL?
- 提交数据,如何让Button的Enable先变为false,再提交。
- 有关windows应用程序和asp.net程序的问题
- AjaxPro的问题
- 求救阿!!!!一个简单的问题,数据更新--------可惜我是个菜鸟!!!!!
- string类型怎样转换为int类型
- 如何用代码触发另外一个按钮的click事件!!!!!!!!!
- 我用VS的向导制作了一个数据集,现在怎么在可视界面中指定DATAGRID的数据源到以上数据集?
- 求购人才网源码,最好带视频那种?
- 打扰大家一下!!!!
/// <summary>
/// 启动网页时的一些操作
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void gvDengji_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow && this.gvDengji.EditIndex != e.Row.RowIndex)
{
LinkButton linkbtnDele = (LinkButton)e.Row.Cells[5].FindControl("lkbtnDel");
linkbtnDele.Attributes.Add("onclick", "return confirm('确认删除吗?')");
}
}
{
((LinkButton)e.Row.Cells[10].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除:\"" + ((LinkButton)e.Row.Cells[3].FindControl("LinkButton")).Text + "\"吗?')");
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{ if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lbDeletes = (LinkButton)e.Row.FindControl("LinkButton2");
if (lbDeletes.Text.Equals("删除"))
{
lbDeletes.Attributes.Add("onclick", "javascript:return confirm('确认删除当前项吗?')");
}
}