private void grdDistributorSites_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "open") { int num = Convert.ToInt32(e.CommandArgument); int userId = Convert.ToInt32(grdDistributorSites.DataKeys[num].Value); Literal literal = (Literal)grdDistributorSites.Rows[num].Cells[3].FindControl("litState"); if (literal.Text == "开启") { if (!DistributorHelper.CloseSite(userId)) { ShowMsg("暂停失败", false); } } else if (!DistributorHelper.OpenSite(userId)) { ShowMsg("开启失败", false); } } BindSites(); }
private void grdDistributorSites_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (e.CommandName == "open") { int index = System.Convert.ToInt32(e.CommandArgument); int userId = System.Convert.ToInt32(this.grdDistributorSites.DataKeys[index].Value); System.Web.UI.WebControls.Literal literal = (System.Web.UI.WebControls.Literal) this.grdDistributorSites.Rows[index].Cells[3].FindControl("litState"); if (literal.Text == "开启") { if (!DistributorHelper.CloseSite(userId)) { this.ShowMsg("暂停失败", false); } } else { if (!DistributorHelper.OpenSite(userId)) { this.ShowMsg("开启失败", false); } } } this.BindSites(); }