/// summary /// 赋值 /// /summary /// param name="sender"/param /// param name="e"/param protected void gvZhTiList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowState
///
/// 赋值
///
///
///
protected void gvZhTiList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
{
LinkButton lnkbtnpicdel = new LinkButton();
lnkbtnpicdel = (LinkButton)e.Row.Cells[gvZhTiList.Columns.Count - 1].FindControl("lnkbtndelpic");
lnkbtnpicdel.CommandArgument = e.Row.RowIndex.ToString();
LinkButton lnkbtnisusers = new LinkButton();
lnkbtnisusers = (LinkButton)e.Row.Cells[gvZhTiList.Columns.Count - 2].FindControl("lnkbtnusers");
lnkbtnisusers.CommandArgument = e.Row.RowIndex.ToString();
}
}
}
///
/// 功能实现
///
///
///
protected void gvZhTiList_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "delpic")
{
string strsqldel = "delete flash_upload where picid=" + gvZhTiList.DataKeys[Convert.ToInt32(e.CommandArgument.ToString())].Value;
int nums = SqlConnections.UpdateOrDelete(strsqldel);
if (nums > 0)
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert(/"图片删除成功!/");</script>");
}
else
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert(/"图片删除失败!/");</script>");
}
}
if (e.CommandName == "isusers")
{
string strsqlisusers = "update flash_upload set isenjoin=case isenjoin when 1 then 0 else 1 end where picid=" + gvZhTiList.DataKeys[Convert.ToInt32(e.CommandArgument.ToString())].Value;
SqlConnections.UpdateOrDelete(strsqlisusers);
}
}