Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PostBack Resets Dropdown list

Status
Not open for further replies.

talenx

Programmer
Aug 7, 2001
157
US
Hello, unforntunally i may need to go back to developing in ASP if this continue but i have a form that has 4 dropdown lists on it as well as validation controls. every time i click the submit button and an vaildation is flagged the page reloads and resets ALL of the dropdown list back to the default selections.

any thoughs as to how i can control this?


here is the code: ( i have removed the other dropdown DS to shorted the code
Code:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
<MM:DataSet
runat="Server"
id="SP_SelectLocation"
IsStoredProcedure="true"
CreateDataSet="true"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_PSF_DataStore") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_PSF_DataStore") %>'
CommandText="dbo.Psf_sp_ActiveLocationList"
Debug="true"
>
  <Parameters>
    <Parameter  Name="@RETURN_VALUE"   Type="Int"   Direction="ReturnValue" />
  </Parameters>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Add New Truck</title>
<link href="css/psf_global_next.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 9px}
-->
</style>
</head>
<body>
<form  name='Form1' runat='server'>
  <table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC" class="textbox_border">
    <tr>
      <td bgcolor="#CCCCCC"><span class="style1"><img src="images/Vaild.gif" width="16" height="15"> <strong>Add New Truck </strong></span></td>
    </tr>
  </table>
  <table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0" class="paperBox" >
    <tr>
      <td><table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0" class="bodyStyle">
          <tr>
            <td width="116" nowrap>Truck Location </td>
            <td width="319" nowrap>
              <asp:DropDownList CssClass="paperBox" DataTextField="Location" DataValueField="Location_Key" ID="dd_TruckLocation" runat="server"  TabIndex="1" DataSource="<%# SP_SelectLocation.DefaultView %>"></asp:DropDownList>
              <asp:CompareValidator ControlToValidate="dd_TruckLocation" Display="Dynamic" ID="CompareValidator1" Operator="LessThanEqual" runat="server" Type="Integer" ValueToCompare="0" ErrorMessage="Truck Location" Text="*"></asp:CompareValidator>              
              </asp:CompareValidator>
            <td width="13" nowrap>&nbsp;</td>
            <td nowrap>Truck Make</td>
            <td nowrap><asp:DropDownList CssClass="paperBox" ID="dd_TruckMake" runat="server" TabIndex="7">
              <asp:ListItem value="">item1</asp:ListItem>
            </asp:DropDownList>
              <asp:CompareValidator ControlToValidate="dd_TruckMake" Display="Dynamic" ID="CompareValidator2" Operator="Equal" runat="server" Type="Integer" ValueToCompare="0" Text="*" ErrorMessage="Truck Make"></asp:CompareValidator></td>
          </tr>
          <tr>
            <td nowrap>Truck Number </td>
            <td nowrap><asp:TextBox CssClass="textbox_border" ID="fld_TruckNbr" runat="server" TextMode="SingleLine" Wrap="false" />
              <asp:RequiredFieldValidator ID="RequiredFieldValidator5" ControlToValidate="fld_TruckNbr" ErrorMessage="Truck Number" Display="Dynamic" runat="server" Text="*"></asp:RequiredFieldValidator>
            <td width="13" nowrap>&nbsp;</td>
            <td width="99" nowrap>Truck Model</td>
            <td width="240" nowrap><asp:DropDownList CssClass="paperBox" ID="dd_TruckModel" runat="server" TabIndex="8">
              <asp:ListItem value="">item1</asp:ListItem>
            </asp:DropDownList>
              <asp:CompareValidator ControlToValidate="dd_TruckModel" Display="Dynamic" ID="CompareValidator3" Operator="Equal" runat="server" Type="Integer" ValueToCompare="0" Text="*" ErrorMessage="Truck Model"></asp:CompareValidator></td>
          </tr>
          <tr>
            <td nowrap>Truck Desc </td>
            <td nowrap><asp:TextBox CssClass="textbox_border" ID="fld_TruckDesc" runat="server" TextMode="SingleLine" Wrap="false" />
              <asp:RequiredFieldValidator ID="RequiredFieldValidator6" ControlToValidate="fld_TruckDesc" ErrorMessage="Truck Desc" Display="Dynamic" runat="server" Text="*"></asp:RequiredFieldValidator></td>
            <td width="13" nowrap>&nbsp;</td>
            <td nowrap>Truck Year</td>
            <td nowrap><asp:DropDownList CssClass="paperBox" ID="dd_TruckYear" runat="server" TabIndex="9">
              <asp:ListItem value="">item1</asp:ListItem>
            </asp:DropDownList>
              <asp:CompareValidator ControlToValidate="dd_TruckYear" Display="Dynamic" ID="CompareValidator4" Operator="Equal" runat="server" Type="Integer" ValueToCompare="0" Text="*" ErrorMessage="Truck Year"></asp:CompareValidator>
            </td>
          </tr>
          <tr>
            <td nowrap>Truck Active </td>
            <td nowrap><asp:CheckBox CssClass="textbox_border" ID="fld_TruckActive" runat="server" /></td>
            <td width="13" nowrap>&nbsp;</td>
            <td nowrap>Notes</td>
            <td nowrap>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap>Truck Mileage</td>
            <td nowrap><asp:TextBox CssClass="textbox_border" ID="fld_TruckMileage" runat="server" TextMode="SingleLine" Wrap="false" />
              <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="fld_TruckMileage" ErrorMessage="Truck Mileage Required" Display="Dynamic" runat="server" Text="*"></asp:RequiredFieldValidator>
              <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="fld_TruckMileage" ErrorMessage="Truck Mileage Not Vaild" Display="Dynamic" runat="server" ValidationExpression="\d*" Text="*"></asp:RegularExpressionValidator>
            </td>
            <td colspan="3" rowspan="3" nowrap><asp:TextBox Columns="30" CssClass="textbox_border" ID="fld_TruckNotes" Rows="3" runat="server" Text='Truck Notes' TextMode="MultiLine" /></td>
          </tr>
          <tr>
            <td nowrap>Reefer Hours </td>
            <td nowrap><asp:TextBox CssClass="textbox_border" ID="fld_TruckReeferHours" runat="server" TextMode="SingleLine" Wrap="false" />
              <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="fld_TruckReeferHours" ErrorMessage="Truck Reefer Hours Required" Display="Dynamic" runat="server" Text="*"></asp:RequiredFieldValidator>
              <asp:RegularExpressionValidator ID="RegularExpressionValidator2" ControlToValidate="fld_TruckReeferHours" ErrorMessage="Truck Reefer Hours Not Valid" Display="Dynamic" runat="server" ValidationExpression="\d*" Text="*"></asp:RegularExpressionValidator></td>
          </tr>
          <tr>
            <td nowrap>&nbsp;</td>
            <td nowrap>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="5"><input type="submit" name="SubmitTruck" value="Submit Truck"  class="submit-button"  tabindex="11">
              <input name="Reset" type="reset" class="submit-button" value="Cancel" tabindex="12"></td>
          </tr>
          <tr>
            <td colspan="5"><asp:ValidationSummary CssClass="paperBox" DisplayMode="BulletList"
                HeaderText="There seems to be an issue with the feilds with an ( * ) next to them:" ID="valSum" runat="server"
                />
            </td>
          </tr>
        </table></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="Form1">
</form>
</body>
</html>

Any assistance would be GREAT!!! Thanks!!

Thanks
TalenX
 
runat server means it will go back to the server to validate the form. Why not do the validation clientside

[Peace][Pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top