//private void AddOptionBtn_Click( System.object sender, System.EventArgs e) AddOptionBtn.Click { protected void AddOptionBtn_Click(object sender, EventArgs e) { // Determine QuestioID int QuestionID = 0; // get { QuestionID from querystring if (!(Request.Params["QuestionID"] == null)) { QuestionID = int.Parse(Request.Params["QuestionID"]); } // new option go to the end of the list OptionItem o = new OptionItem(); o.OptionName = this.TxtNewOption.Text; o.OptionID = -1; o.OptionOrder = 999; portalOption.Add(o); // write tab to database SurveyDB NewOption = new SurveyDB(); o.OptionID = NewOption.AddOption(QuestionID, o.OptionName, o.OptionOrder); // Reset the order numbers for the tabs within the list OrderOptions(); // Redirect to edit page Response.Redirect(Request.RawUrl); }
private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { // Set the ImageUrl for controls from current Theme upBtn.ImageUrl = this.CurrentTheme.GetImage("Buttons_Up", "Up.gif").ImageUrl; downBtn.ImageUrl = this.CurrentTheme.GetImage("Buttons_Down", "Down.gif").ImageUrl; deleteBtn.ImageUrl = this.CurrentTheme.GetImage("Buttons_Delete", "Delete.gif").ImageUrl; } //TBD: Create a sproc that gets these fields: //CreatedBy.Text = (string) dr["CreatedByUser"]; //CreatedDate.Text = ((DateTime) dr["CreatedDate"]).ToShortDateString(); // get { QuestionID from querystring if (!(Request.Params["QuestionID"] == null)) { int QuestionID = 0; QuestionID = int.Parse(Request.Params["QuestionID"]); SurveyDB OptList = new SurveyDB(); SqlDataReader OList = OptList.GetOptionList(QuestionID); try { while (OList.Read()) { OptionItem o = new OptionItem(); o.OptionName = OList["OptionDesc"].ToString(); o.OptionID = (int)OList["OptionID"]; o.OptionOrder = (int)OList["ViewOrder"]; portalOption.Add(o); } } finally { OList.Close(); //by Manu, fixed bug 807858 } if (!Page.IsPostBack) { this.OptionList.DataTextField = "OptionName"; this.OptionList.DataValueField = "OptionID"; this.OptionList.DataSource = portalOption; this.OptionList.DataBind(); this.lblQuestion.Text = Request.Params["Question"]; if (Request.Params["TypeOption"] == "RD") { this.lblTypeOption.Text = Esperantus.Localize.GetString("SURVEY_RADIOBUTTONS", "Radio buttons", this); } else { this.lblTypeOption.Text = Esperantus.Localize.GetString("SURVEY_CHECKBOXES", "Checkboxes", this); } } } }