コード例 #1
0
ファイル: EditSubject.aspx.cs プロジェクト: xyecom/AMS
        private void InitOption(int subjectId)
        {
            System.Collections.Generic.List<Model.VoteOptionsInfo> list = new Business.VoteOptions().GetItemsBySubjectId(subjectId);

            Table t = new Table();

            t.ID = "tablePollOption";
            t.Attributes.Add("class", "PollTable");

            TableRow row = new TableRow();
            TableCell cell = new TableCell();

            //row.Attributes.Add("class", "t");

            int i = 1;
            foreach (XYECOM.Model.VoteOptionsInfo option in list)
            {
                row = new TableRow();

                cell = new TableCell();
                cell.Text = i + ".";

                row.Cells.Add(cell);

                cell = new TableCell();
                //Option Body
                HtmlTextArea txt = new HtmlTextArea();
                txt.Rows = 2;
                txt.Cols = 60;
                txt.ID = "option" + i;
                txt.Value = option.Text;
                cell.Controls.Add(txt);
                //Option Id
                HtmlInputHidden hidden = new HtmlInputHidden();
                hidden.ID = "option_id_" + i;
                hidden.Value = option.OptionId.ToString();
                cell.Controls.Add(hidden);

                row.Cells.Add(cell);

                cell = new TableCell();
                cell.ID = "tdDel_" + i;

                if (i == list.Count && i != 1)
                    cell.Attributes.Add("style", "display:;");
                else
                    cell.Attributes.Add("style", "display:none;");

                cell.Text = "<a href=\"#\" onclick=\"DeletePollOption(" + i + ");DeleteServerOption('" + option.OptionId + "');\"><img src=\"../images/delete1.gif\" alt=\"删除\" border=\"0\"/></a>";

                row.Cells.Add(cell);

                t.Rows.Add(row);
                i++;
            }

            this.OptionTotal.Value = list.Count.ToString();
            phOptions.Controls.Add(t);
        }
コード例 #2
0
ファイル: SubjectManage.aspx.cs プロジェクト: ZhaiQuan/Zhai
        protected string GetOptions(string type, string _subjectId)
        {
            if (type.Equals("text") || type.Equals("mtext")) return "----";

            int subjectId = Core.MyConvert.GetInt32(_subjectId);

            if (subjectId <= 0) return "----";

            System.Collections.Generic.List<Model.VoteOptionsInfo> options = new Business.VoteOptions().GetItemsBySubjectId(subjectId);

            System.Text.StringBuilder body = new System.Text.StringBuilder("");

            foreach (Model.VoteOptionsInfo option in options)
            {
                body.Append(option.Text);
                body.Append("<br/>");
            }

            return body.ToString();
        }