我用Show Smart Tag 生成了链接字符串,编辑,删除和超级链接列.1. 编辑,删除和超级链接列,显示的是Edit,Delete和自己字义的定符,现在我想让这些Edit,Delete,和自己定义的显示成为一些小图片.应该如何来做?2. 删除前提示应该如何来写?3. 假如我添加了一个DownList,可否直接来显示颜色(数据库中有一个color字段记录颜色的值)能解决前两个就成...帮个忙,不是模板列是用Show Smart Tag生成的...
调试欢乐多
============================================================
<asp:CommandField ShowEditButton="True" EditText="<img src=1.gif />" />
==============================================
转自清清月儿博客双击GridView的OnRowDataBound事件;
在后台的GridView1_RowDataBound()方法添加代码,最后代码如下所示: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//如果是绑定数据行
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
{
((LinkButton)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除:\"" + e.Row.Cells[1].Text + "\"吗?')");
}
} }
===========================================================
这个肯定要用模版列了
Specified argument was out of the range of valid values.
Parameter name: index
{ e.Row.Cells[0].Attributes.Add("onclick", "return confirm('你确认要编辑吗?')"); }
如果这样的话,无论是点击编辑和删除,都会出现提示..按照刚才的写法的话,只有编辑会出现提示,删除还是直接执行的.
是不是要判断一下操作??
2、<asp:LinkButton ID="lbDel" runat="server" Text="删除" CommandName="DeleteUser" OnCommand="LinkButtonClick" ForeColor="blue" OnClientClick="return confirm('确定删除该用户吗?');"></asp:LinkButton>