We help IT Professionals succeed at work.

how to get html 'form' values on the server

shwaqar82 asked
Last Modified: 2012-05-05
How can i get the html control values in asp.net function. or in querystring.......?
i have the following page:
<%@ Page Language="VB" Debug="True" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Net.WebRequest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<script language="javascript" src="datePicker.js"></script>
<script type='text/javascript' src='groups-searchform.js'></script>
<script type='text/javascript' src='packages.js'></script>

<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim arg As String = Request.Form("__EVENTTARGET")
    Dim val As String = Request.Form("__EVENTARGUMENT")
    If (arg = "CHK") Then
    End If
End Sub

Public Function CheckAvailibility() As Boolean
End Function
<body onLoad="initdropdown();initdropdown1();">
<form name="frm" action="mygroup.aspx" method="post">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
            <select name="gateway_dep" onchange="refreshDest()">
            <select name="dest_dep" onchange="destchanged()">
                  <select name="no_hotel">
            <select name="departure_month">
          <option value="01">January</option>
          <option value="02">February</option>
          <option value="03">March</option>
          <option value="04">April</option>
          <option value="05">May</option>
          <option value="06">June</option>
          <option value="07">July</option>
          <option value="08">August</option>
          <option value="09">September</option>
          <option value="10">October</option>
          <option value="11">November</option>
          <option value="12">December</option>
            <select name="departure_day" onchange="javascript:__doPostBack('CHK','');">
            <option value="01">1</option>
            <option value="02">2</option>
            <option value="03">3</option>
            <option value="04">4</option>
            <option value="05">5</option>
            <option value="06">6</option>
            <option value="07">7</option>
            <option value="08">8</option>
            <option value="09">9</option>
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
            <option value="13">13</option>
            <option value="14">14</option>
            <option value="15">15</option>
            <option value="16">16</option>
            <option value="17">17</option>
            <option value="18">18</option>
            <option value="19">19</option>
            <option value="20">20</option>
            <option value="21">21</option>
            <option value="22">22</option>
            <option value="23">23</option>
            <option value="24">24</option>
            <option value="25">25</option>
            <option value="26">26</option>
            <option value="27">27</option>
            <option value="28">28</option>
            <option value="29">29</option>
            <option value="30">30</option>
            <option value="31">31</option>
<form id="Form1" method="post" runat="server">
<asp:TextBox id="txtMessage" runat="server" TextMode="MultiLine" AutoPostBack="True" Width="500px" Height="250px"></asp:TextBox>

please help me in finding out the way how can i get the selected item text in asp.net function. Most of the select box here gets populated using client side javascript and my restriction is i cant make my form runat=server. If i did that then none of the select box gets populated. So all i need to do is to get the selected item text or values on the server side.
I can accept anything as a solution that gives me html select control's selected item text or values on server side. Either use session, server side javascript etc....just make sure that im using asp.net using vb.net.  
Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
Sorry. Like this:

<form name="frm" action="mygroup.aspx" method="post" runat=server id=dept>

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.