GridView命令不够用怎么办?

1.在GridView里添加一个模板列,放一个 ImageButton,然后再双击控件,在单击事件里写下面类似的代码:
        ImageButton Lb1 = (ImageButton)sender;
        DataControlFieldCell dcf = (DataControlFieldCell)Lb1.Parent;
        GridViewRow Gvr = (GridViewRow)dcf.Parent;
        string TempID = gvChecks.DataKeys[Gvr.RowIndex].Value.ToString();
        Response.Redirect("CheckDetail.aspx?id=" + TempID);
2.原理大致是:一次获取上级控件,然后确定DataKeys的值(好像是吧?呵呵)

你可能感兴趣的:(GridView)