private void Page_Init(object sender, System.EventArgs e)
        {
            DynamicControlsDS
                DS = new DynamicControlsDS();

            System.Web.UI.WebControls.DropDownList
                tmpDropDownList;

            tmpDropDownList    = new DropDownList();
            tmpDropDownList.ID = DynamicDropDownListSignature;

            tmpDropDownList.DataSource     = DS.Tables["TestTable"];
            tmpDropDownList.DataValueField = "Id";
            tmpDropDownList.DataTextField  = "Description";
            tmpDropDownList.DataBind();

            TestDynamicComboBoxForm.Controls.Add(tmpDropDownList);
        }
예제 #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            LabelInfo.Text = string.Empty;
                        #if USE_CHECK_BOX_LIST
            System.Web.UI.WebControls.CheckBoxList
                tmpCheckBoxList;

            if ((tmpCheckBoxList = FindControl(DynamicCheckBoxSignature) as System.Web.UI.WebControls.CheckBoxList) != null)
            {
                for (int i = 0; i < tmpCheckBoxList.Items.Count; ++i)
                {
                    if (tmpCheckBoxList.Items[i].Selected)
                    {
                        if (LabelInfo.Text != string.Empty)
                        {
                            LabelInfo.Text += " ";
                        }
                        LabelInfo.Text += tmpCheckBoxList.Items[i].Value;
                    }
                }
            }
                        #else
            DynamicControlsDS
                DS = new DynamicControlsDS();

            System.Web.UI.WebControls.CheckBox
                tmpCheckBox;

            foreach (DataRow row in DS.Tables["TestTable"].Rows)
            {
                if ((tmpCheckBox = FindControl(DynamicCheckBoxSignature + Convert.ToInt64(row["Id"])) as System.Web.UI.WebControls.CheckBox) != null &&
                    tmpCheckBox.Checked)
                {
                    if (LabelInfo.Text != string.Empty)
                    {
                        LabelInfo.Text += " ";
                    }
                    LabelInfo.Text += Convert.ToString(Convert.ToInt64(row["Id"]));
                }
            }
                        #endif
        }
예제 #3
0
        private void Page_Init(object sender, System.EventArgs e)
        {
            System.Web.UI.HtmlControls.HtmlForm
                form;

            if ((form = this.FindControl("TestDynamicCheckBoxForm") as System.Web.UI.HtmlControls.HtmlForm) != null)
            {
                DynamicControlsDS
                    DS = new DynamicControlsDS();

                                #if USE_CHECK_BOX_LIST
                System.Web.UI.WebControls.CheckBoxList
                    tmpCheckBoxList;

                tmpCheckBoxList    = new CheckBoxList();
                tmpCheckBoxList.ID = DynamicCheckBoxSignature;

                tmpCheckBoxList.DataSource     = DS.Tables["TestTable"];
                tmpCheckBoxList.DataValueField = "Id";
                tmpCheckBoxList.DataTextField  = "Description";
                tmpCheckBoxList.DataBind();

                form.Controls.Add(tmpCheckBoxList);
                                #else
                System.Web.UI.WebControls.CheckBox
                    tmpCheckBox;


                foreach (DataRow row in DS.Tables["TestTable"].Rows)
                {
                    tmpCheckBox      = new CheckBox();
                    tmpCheckBox.ID   = DynamicCheckBoxSignature + Convert.ToInt64(row["Id"]);
                    tmpCheckBox.Text = Convert.ToString(row["Description"]);
                    form.Controls.Add(tmpCheckBox);
                }
                                #endif
            }
        }