I have a simple ASP.NET web form as below:
<form id="form1" runat="server">
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
<asp:DropDownList ID="ddl" runat="server">
<asp:ListItem Text="X" Value="X"></asp:ListItem>
<asp:ListItem Text="Y" Value="Y"></asp:ListItem>
<asp:ListItem Text="Z" Value="Z"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btn" runat="server" Text="Button" />
</form>
Request.Form contains the following key/value pairs:
[0] _VIEWSTATE
[1] _EVENTVALIDATION
[2] txt
[3] ddl
[4] btn
How do I differentiate the button (btn) from Textbox value (txt) or DropDown List value (ddl)? Or do I need to somehow come up with a naming convention? I am trying to iterate Request.Form object and save form values into a hashtable for later use.
Thanks.