public void ShowQuestions() { PlaceHolder1.Controls.Clear(); //throw new Exception("Show Question"); foreach (DataRow ObjRow in Company_Question.GetCompany_QuestionRecords("CompanyId=" + Request.QueryString["Id"]).Rows) { Company_ViewQuestion ObjViewQuestion = (Company_ViewQuestion)this.LoadControl("ViewQuestion.ascx"); ObjViewQuestion.QuestionID = (int)ObjRow["QuestionId"]; PlaceHolder1.Controls.Add(ObjViewQuestion); } //Page_Load(null, null); }
protected void BtnAddQuestion_Click(object sender, EventArgs e) { if (this.Page.IsPostBack == true) { if (this.IsValid == true) { //throw new Exception("hi"); int QuestionId = Question.AddQuestion(DateTime.Now, TxtQuestion.Text, DdlRelatedTo.SelectedValue); Company_Question.AddCompany_Question(QuestionId, int.Parse(Request.QueryString["Id"])); TxtQuestion.Text = string.Empty; DdlRelatedTo.SelectedIndex = 0; DivAddQuestionModal.Visible = false; this.Form.DefaultButton = string.Empty; ShowQuestions(); Page_Load(null, null); } } }