yunxizfj

等待...

导航

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的值(好像是吧?呵呵)

posted on 2008-03-06 10:44  yunxizfj  阅读(298)  评论(2编辑  收藏  举报