hi
i have checkboxes , textboxes and drop down list boxes in an aspx web page, how do i get the data that is being entered by the user. and where should i write the code or it

thanks
appreciate a reply

thanks

Recommended Answers

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

Jump to Post

All 2 Replies

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

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);
            }
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.