//控制行绑定数据 RowDataBound事件为控件绑定数据时触发
protected void grdList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
if(e.Row.Cells[5].Text == "0")
{
e.Row.Cells[5].Text == "随便设置";
}
}
}
//Gridview行删除
---添加事件--:onrowcommand="gvwUserList_RowCommand"
---添加行--:<asp:ButtonField ButtonType="Image" ImageUrl="~/Image/Delete.gif" CommandName="Close" ItemStyle-HorizontalAlign="Center" />
后台方法
protected void gvwUserList_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Close")
{
//获取选择行的DataKeys
int myID = Convert.ToInt32(gvwUserList.DataKeys[Convert.ToInt32(e.CommandArgument)][0]);
Meeting.Delete(myID.ToString());
}
gvwUserList.DataSource = Meeting.GetMyorderById(Myname);
gvwUserList.DataBind();
}
浙公网安备 33010602011771号