protected void uiButtonCancel_Click(object sender, EventArgs e) { Clearfields(); CurrentSubCategory = null; uiPanelEdit.Visible = false; uiPanelViewSubCategories.Visible = true; }
protected void uiButtonUpdate_Click(object sender, EventArgs e) { if (CurrentSubCategory != null) { UpdateRecord(); } else { AddNewRecord(); } uiPanelEdit.Visible = false; uiPanelViewSubCategories.Visible = true; BindData(); Clearfields(); CurrentSubCategory = null; }
protected void uiGridViewSubCategories_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditSubCategory") { SubCategories objData = new SubCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxEnName.Text = objData.EnName; uiTextBoxArName.Text = objData.ArName; uiTextBoxEnDesc.Text = objData.EnDescription; uiTextBoxArDesc.Text = objData.ArDescription; uiDropDownListAllCategories.SelectedValue = objData.CategoryID.ToString(); uiPanelViewSubCategories.Visible = false; uiPanelEdit.Visible = true; CurrentSubCategory = objData; uiPanelViewSubCategories.Visible = false; uiPanelEdit.Visible = true; } else if (e.CommandName == "DeleteSubCategory") { SubCategories objData = new SubCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentSubCategory = null; BindData(); } }