• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 654
  • Last Modified:

how to get html 'form' values on the server

Hi
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">

<head>
<title>Groups</title>
<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
        CheckAvailibility()
    End If
End Sub

Public Function CheckAvailibility() As Boolean
        Response.Redirect("http://www.yahoo.com");
End Function
</script>
</head>
<body onLoad="initdropdown();initdropdown1();">
<form name="frm" action="mygroup.aspx" method="post">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
      <tr>
        <td>
            <select name="gateway_dep" onchange="refreshDest()">
          <option></option>
        </select>
            </td>
      </tr>
      <tr>
        <td>
            <select name="dest_dep" onchange="destchanged()">
          <option></option>
        </select>
            </td>
      </tr>
      <tr>
              <td>
                  <select name="no_hotel">
                      <option></option>
              </select>
            </td>
      </tr>
      <tr>
        <td>
            <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>
            <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>
          </select>
            </td>
                      </tr>
    </table>
</form>
<form id="Form1" method="post" runat="server">
<asp:TextBox id="txtMessage" runat="server" TextMode="MultiLine" AutoPostBack="True" Width="500px" Height="250px"></asp:TextBox>
</form>
</div>
</body>
</html>

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.  
0
shwaqar82
Asked:
shwaqar82
  • 2
1 Solution
 
digitalZoCommented:
Give an id to the dropdown, runat=server and then call the selected value on the server side.

Something like this:

<select id="dept" runat="serve" name="departure_day" onchange="javascript:__doPostBack('CHK','');">

In Code-behind:

dept.SelectedValue
0
 
digitalZoCommented:
Sorry. Like this:

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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now