public static void FillDropDownListContactCategory(DropDownList ddl) { ContactCategoryBAL balContactCategory = new ContactCategoryBAL(); ddl.DataSource = balContactCategory.SelectForDropdownList(); ddl.DataValueField = "ContactCategoryID"; ddl.DataTextField = "ContactCategoryName"; ddl.DataBind(); ddl.Items.Insert(0, new ListItem("Select Item", "-1")); }
private void FillGridViewContactCategory() { ContactCategoryBAL balContactCategory = new ContactCategoryBAL(); DataTable dtContactCategory = new DataTable(); dtContactCategory = balContactCategory.SelectAll(); if (dtContactCategory != null && dtContactCategory.Rows.Count > 0) { gvContactCategoryList.DataSource = dtContactCategory; gvContactCategoryList.DataBind(); } }
protected void btnSave_Click(object sender, EventArgs e) { #region Server Side Validation lblError.Text = ""; if (txtContactCategoryName.Text.Trim().ToUpper() == "") { lblError.Text += "Enter ContactCategory Name <br/>"; } if (lblError.Text != "") { return; } #endregion Server Side Validation #region Collecting Data ContactCategoryENT entContactCategory = new ContactCategoryENT(); if (txtContactCategoryName.Text.Trim().ToUpper() != "") { entContactCategory.ContactCategoryName = txtContactCategoryName.Text.Trim().ToUpper(); } ContactCategoryBAL balContactCategory = new ContactCategoryBAL(); #endregion Collecting Data if (Request.QueryString["ContactCategoryID"] == null) { #region insertingData if (balContactCategory.Insert(entContactCategory)) { Response.Redirect("~/AdminPanel/ContactCategory/ContactCategoryList.aspx"); } else { lblError.Text = balContactCategory.Message; } #endregion insertingData } else { #region updatingData entContactCategory.ContactCategoryID = Convert.ToInt32(Request.QueryString["ContactCategoryID"]); if (balContactCategory.Update(entContactCategory)) { Response.Redirect("~/AdminPanel/ContactCategory/ContactCategoryList.aspx"); } else { lblError.Text = balContactCategory.Message; } #endregion updatingData } }
protected void gvContactCategoryList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandArgument != null) { ContactCategoryBAL balContactCategory = new ContactCategoryBAL(); if (balContactCategory.Delete(Convert.ToInt32(e.CommandArgument.ToString().Trim()))) { Response.Redirect("~/Adminpanel/ContactCategory/ContactCategoryList.aspx"); lblError.Text = ""; } else { lblError.Text = balContactCategory.Message; } } }
private void fillControls(SqlInt32 ContactCategoryID) { ContactCategoryENT entContactCategory = new ContactCategoryENT(); ContactCategoryBAL balContactCategory = new ContactCategoryBAL(); entContactCategory = balContactCategory.SelectByPK(ContactCategoryID); if (entContactCategory != null) { if (!entContactCategory.ContactCategoryName.IsNull) { txtContactCategoryName.Text = entContactCategory.ContactCategoryName.Value.ToString(); } } else { lblError.Text = balContactCategory.Message; } }