protected void btnView_Click(object sender, EventArgs e) { LinkButton viewLinkBtn = (LinkButton)sender; ErrorControl1.DisableControls(divForm); BtnSave.CommandArgument = "2"; // lblInstitution.Text = "Update Stock"; // BtnSave.Text = "Update Stock"; var stockId = int.Parse(viewLinkBtn.CommandArgument); ViewState["StockId"] = stockId; var stockObj = _db.Stocks.FirstOrDefault(m => m.StockID == stockId); if (stockObj != null) { txtName.Value = stockObj.Name; txtBarcode.Text = stockObj.Code; txtDescription.Text = stockObj.Description; ddlCategory.SelectedValue = stockObj.CategoryId.ToString(); ddlVendor.SelectedValue = stockObj.VendourId.ToString(); //string savePath = Server.MapPath("~/StockImages/"); if (!string.IsNullOrEmpty(stockObj.FilePath)) { lblLogo.InnerText = ""; } UpLoadedPhoto.ImageUrl = "~/StockImages/" + stockObj.FilePath; } BtnCancel.Visible = false; BtnSave.Visible = false; divList.Visible = false; divForm.Visible = true; }
protected void btnView_Click(object sender, EventArgs e) { LinkButton viewLinkBtn = (LinkButton)sender; ErrorControl1.DisableControls(divFormIv); BtnSave.CommandArgument = "2"; // lblInstitution.Text = "Update Stock"; // BtnSave.Text = "Update Stock"; var inventoryId = int.Parse(viewLinkBtn.CommandArgument); ViewState["InventoryId"] = inventoryId; var inventoryObj = _db.Inventories.FirstOrDefault(m => m.InventoryId == inventoryId); if (inventoryObj != null) { ddlStock.Text = (inventoryObj.StockId).ToString(); txtCostPrice.Text = inventoryObj.CostPrice.ToString().Trim(); txtQuantity.Text = inventoryObj.Quantity.ToString(); txtReoderLevel.Text = inventoryObj.ReorderLevel.ToString().Trim(); if (inventoryObj.Permision == true) { chkRequired.Checked = true; } else { chkRequired.Checked = false; } } BtnCancel.Visible = false; BtnSave.Visible = false; divList.Visible = false; divFormIv.Visible = true; }