62,268
社区成员
发帖
与我相关
我的任务
分享
protected void dgr_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
//更新按扭事件
string strId = this.dgr.DataKeys[e.Item.ItemIndex].ToString();
string strServerType = ((TextBox)(e.Item.Cells[2].Controls[0])).Text; //获取对应行的Textbox值
string strAllow=((TextBox)(e.Item.Cells[5].Controls[0])).Text;
string strSql = "update TS_SERVER_MGR set SM_Utype='" + strServerType + "',SM_Turn='"+strAllow+"'where SM_Id='" +strId+ "'";
BaseService bc = new BaseService();
bc.OpenConnect();
bc.ExecuteNonQuery(strSql);
this.dgr.EditItemIndex = -1;
thisDataBind();
}
Label labName = (Label)GridView1.Rows[e.NewEditIndex].Cells[5].FindControl("labName");