protected void grdListImg_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": Id = strCA; List <Data.ImagesDetail> listE = ImagesDetailBUS.ImageDetail_GetById(Id); txtId.Text = strCA; txtName.Text = listE[0].Name; txtsummary.Text = listE[0].Summary; if (listE[0].Image.Length > 0) { txtImage.Text = listE[0].Image; imgImage.Visible = true; imgImage.ImageUrl = listE[0].Image; } //if (listE[0].Image.Length > 0) //{ // txtImagesmall.Text = listE[0].Image; // Image1.Visible = true; // Image1.ImageUrl = listE[0].Image; //} //else //{ // trImages.Visible = false; //} //txtWidth.Text = listE[0].Width; //txtHeight.Text = listE[0].Height; txtLink.Text = listE[0].ImageId; txtsummary.Text = listE[0].Summary; chkActive.Checked = listE[0].Active == "1" || listE[0].Active == "True"; pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": string strA = ""; string str = e.Item.Cells[2].Text; strA = str == "1" ? "0" : "1"; SqlDataProvider sql = new SqlDataProvider(); sql.ExecuteNonQuery("Update [ImagesDetail] set Active=" + strA + " Where Id='" + strCA + "'"); BindGrid(); break; case "Delete": Bus.ImagesDetailBUS.ImagesDetail_Delete(strCA); BindGrid(); break; case "Image": Response.Redirect("/Admins/ImagesDetail.aspx?ImagesId=" + strCA + ""); break; } }
protected void grdProductImage_ItemCommand(object source, DataGridCommandEventArgs e) { string strCA = e.CommandArgument.ToString(); switch (e.CommandName) { case "Edit": txtId.Text = strCA; txtName.Text = ""; List <Data.ImagesDetail> ListE = ImagesDetailBUS.ImageDetail_GetById(strCA); txtImage.Text = ListE[0].Image.Length > 0 ? ListE[0].Image : ""; pnView.Visible = false; pnUpdate.Visible = true; break; case "Active": break; case "Delete": break; } }