/// <summary> /// Builds and populates the dropdown list with the current /// Xml filename gathered from the answer publisher /// </summary> protected virtual void GenerateDropDownList() { this.Controls.Clear(); this._xmlAnswerDropDownList = new DropDownList(); NSurveyDataSource xmlAnswers = new XmlFileManager(this.XmlFileName).GetXmlAnswers(base.LanguageCode); if ((xmlAnswers != null) && (xmlAnswers.XmlAnswer.Count > 0)) { if (((xmlAnswers.XmlDataSource.Rows.Count > 0) && (xmlAnswers.XmlDataSource[0].RunTimeAnswerLabel != null)) && (xmlAnswers.XmlDataSource[0].RunTimeAnswerLabel.Length > 0)) { this.Text = xmlAnswers.XmlDataSource[0].RunTimeAnswerLabel; } if (this.ShowAnswerText) { if ((this.ImageUrl != null) && (this.ImageUrl.Length != 0)) { Image child = new Image(); child.ImageUrl = this.ImageUrl; child.ImageAlign = ImageAlign.Middle; child.ToolTip = this.Text; this.Controls.Add(child); this.Controls.Add(new LiteralControl("<br />")); } else if ((this.Text != null) && (this.Text.Length != 0)) { //JJ this.Controls.Add(new LiteralControl(string.Format("{0}<br />", this.Text))); Label label = new Label(); label.Text = string.Format("{0}<br />", this.Text); label.CssClass = "AnswerTextRender"; this.Controls.Add(label); } } this.BindDropDownList(xmlAnswers); if ((this.DefaultText != null) && (this._xmlAnswerDropDownList.Items.FindByValue(this.DefaultText) != null)) { this._xmlAnswerDropDownList.SelectedValue = this.DefaultText; } if (this.HasSubscribers) { this._xmlAnswerDropDownList.AutoPostBack = true; } this.Controls.Add(this._xmlAnswerDropDownList); PostedAnswerDataCollection answerValues = this.GetAnswerValues(); if (answerValues != null) { this.OnAnswerPublisherCreated(new AnswerItemEventArgs(answerValues)); } } }
protected override void CreateChildControls() { XmlFileManager manager = new XmlFileManager(this.DataSource); this.GenerateXmlControl(manager.GetXmlAnswers(base.LanguageCode)); }