3
Contributors
2
Replies
12
Views
4 Years
Discussion Span
Last Post by ggamble
0

If you are using a code-behind page (example.aspx.cs), you can access those objects and their data.

For example...

textBox1.text, or dropDown1.selectedValue

0

In C#, this will loop throuh all controls and get their values ... you need to do something with it them though.

        private void GetControlValues(Control parent)
        {
            foreach (Control c in parent.Controls)
            {
                if (c is DropDownList)
                {
                   string ddlValue =  ((DropDownList)(c)).SelectedValue;
                }

                if (c is TextBox)
                {
                   string txtbox =  ((TextBox)(c)).Text;
                }

                if (c is CheckBox)
                {
                   bool value =  ((CheckBox)(c)).Checked;
                }
                GetControlValues(c);
            }
        }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.