示例#1
0
        protected void btnSaveOption_Click(object sender, EventArgs e)
        {
            FormGeneratorData data = new FormGeneratorData();

            if (txtText.Text != "" && txtValue.Text != "")
            {
                if (hfControlOptionID_ForEdit.Value == "")
                {
                    data.AddControlOption(hfPageControlID_DD_ForEdit.Value, txtText.Text, txtValue.Text);
                    LogMessage("Added Dropdown Option.");
                }
                else
                {
                    data.UpdateControlOption(hfControlOptionID_ForEdit.Value, txtText.Text, txtValue.Text);
                    hfControlOptionID_ForEdit.Value = "";
                    LogMessage("Updated Dropdown Option.");
                }

                txtText.Text = "";
                txtValue.Text = "";
                btnSaveOption.Text = "Add";
            }

            if (txtDefaultOption.Text != "")
                data.SavePageControlDefaultOption(txtDefaultOption.Text, hfPageControlID_DD_ForEdit.Value);

            DataTable dtOptions = data.GetControlOptionsByPageControl_ID(hfPageControlID_DD_ForEdit.Value);

            rptrOptions.DataSource = dtOptions;
            rptrOptions.DataBind();
        }