给grivdView不要设值 button的url和 commandName 在rowDatabound中操作变换
protected void GVData_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
ImageButton ibtnApprove = (ImageButton)e.Row.FindControl("ibtnApprove");
string submitState = GVData.DataKeys[e.Row.RowIndex]["Approved"].ToString().Trim();///DataKey实在gridView中头部设置的索引
if (submitState == "同意")
{
ibtnApprove.ImageUrl = "../images/Button/btn_quxiao.gif";
ibtnApprove.CommandName = "DropApproved";
}
else
{
ibtnApprove.ImageUrl = "~/images/Button/Submit.jpg";
ibtnApprove.CommandName = "Approved";
}
}
}