I have a simple web form which consists of several text box and drop downs. I need a way to get the value of all of the elements from the start in a list. I know I can individually get the value using textbox1.value but I wouldn't know how many textbox/dropdown there are in the form. For example
<form id="form1" runat="server">
<div>
Tier:
<asp:DropDownList ID="Tier" runat="server">
<asp:ListItem>Select Tier</asp:ListItem>
<asp:ListItem>Tier1</asp:ListItem>
<asp:ListItem>Tire2</asp:ListItem>
<asp:ListItem>Tier3</asp:ListItem>
</asp:DropDownList>
Author:
<asp:DropDownList ID="Author" runat="server">
<asp:ListItem>Select Author</asp:ListItem>
<asp:ListItem>Author1</asp:ListItem>
<asp:ListItem>Author2</asp:ListItem>
<asp:ListItem>Author3</asp:ListItem>
</asp:DropDownList>
Quotation For:
<asp:TextBox ID="questionfor" runat="server"></asp:TextBox>
</div>
How do I get the value in a list ? How do I loop through them ? The final aim is to store the element Id and its value in the database. Hence along with the value I need the id as well. For example in the database I will have two column elementName(which is the elementID) and its corresponding value.