protected void btnAdd_Click(object sender, EventArgs e) { LoggedIn master = (LoggedIn)this.Master; QuestAnsBE Ko = new QuestAnsBE(); QuestAnsBAL KoBAL = new QuestAnsBAL(); if (ValidData()) { return; } Ko.Subject = txtSubject.Text; Ko.Tag = txtTag.Text; Ko.ShortDesc = txtShortDesc.Text; Ko.DelDesc = txtDelDesc.Text.Replace(Environment.NewLine,"<br/>"); Ko.Note = txtNote.Text.Replace(Environment.NewLine, "<br/>"); Ko.KOText = txtKOText.Text; Ko.KOType = ddlKOType.SelectedItem.Text; Ko.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; if (KoBAL.AddKO(Ko)) { foreach (Control txt in divAddKO.Controls) { if (txt is TextBox) ((TextBox)(txt)).Text = string.Empty; else if (txt is DropDownList) ((DropDownList)(txt)).SelectedIndex = 0; } master.ShowMessage("Record Added Successfully", true); } else { master.ShowMessage("Unsuccessful", false); } }