protected void uiGridViewSubCategories_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditCategory") { SubCategories objData = new SubCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxArName.Text = objData.Title; uiPanelViewCategories.Visible = false; uiPanelEdit.Visible = true; CurrentSubCategory = objData; } else if (e.CommandName == "DeleteCategory") { SubCategories objData = new SubCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentSubCategory = null; BindData(); } }
private void AddNewRecord() { SubCategories objData = new SubCategories(); objData.AddNew(); objData.Title = uiTextBoxArName.Text; objData.CategoryID = Convert.ToInt32(uiDropDownListAllCategories.SelectedValue); if (uiFileUploadPicturePath.HasFile) { uiFileUploadPicturePath.SaveAs(Server.MapPath("~/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName)); objData.IconPath = "/UploadedFiles/Cats/" + uiFileUploadPicturePath.FileName; } objData.Save(); }