Hello Kalahaine.
Here is my Page_Load event from my aspx.vb code behind file and my html code. I had to use the Page_load event because i can't find an OnLoad event in the drop down of events.
Thanks,
Tony
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Page.ClientScript.RegisterClientScriptBlock(Me.[GetType](), "hideCalendar", "function hideCalendar(cb) { cb.hide(); }", True) MyBase.OnLoad(e)
Me.getTruckMileageCompletedTextbox.Visible = False
If Not Page.IsPostBack Then
Me.startDateCalendar.Text = Today
Me.endDateCalendar.Text = Today
End If
End Sub
<%@ Page Language="VB" MasterPageFile="~/AppMaster.Master" CodeFile="GetTruckMileage.aspx.vb" Inherits="GetTruckMileage" title="Coyne Web Services - Get Truck Mileage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="mainCopy" runat="server">
<div class="container">
<h1>Coyne Chemical Trips and Truck Mileage
</h1>
<p class="teaser">
Coyne Chemical Trips and Truck Mileage from Xatanet.
</p>
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Start Date:"></asp:Label>
<cc1:CalendarExtender ID="startDateCalendarExtender" runat="server" TargetControlID="startDateCalendar" OnClientDateSelectionChanged='hideCalendar'>
</cc1:CalendarExtender>
<asp:TextBox ID="startDateCalendar" runat="server" ></asp:TextBox>
<asp:Button ID="getTruckMileageButton" Text="Get Truck Mileage" runat="server" /> <br />
<br />
<asp:Label ID="Label2" runat="server" Text="End Date:" ></asp:Label>
<asp:TextBox ID="endDateCalendar" runat="server" ></asp:TextBox>
<cc1:CalendarExtender ID="endDateCalendarExtender" runat="server" TargetControlID="endDateCalendar" OnClientDateSelectionChanged='hideCalendar'>
</cc1:CalendarExtender>
<asp:Button ID="exportTripsButton" runat="server" Text="Export to HP3000" />
<br />
<br />
<span id="progressMsg">
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="startDateCalendar"
ControlToValidate="endDateCalendar" ErrorMessage="End Date cannot be less than Start Date" Type="Date" Operator="GreaterThanEqual"></asp:CompareValidator>
</span>
<br />
<br />
<asp:Textbox ID="getTruckMileageCompletedTextbox" runat="server" ReadOnly="True" Width="390px" Height="150px" TextMode="MultiLine" Rows="10"></asp:Textbox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgressMsg" runat="server">
<ProgressTemplate>
<span id="progressMsg">
Update in progress... Please wait
</span>
</ProgressTemplate>
</asp:UpdateProgress>
<br />
</div>
<br />
<div class="container">
<br />
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:ObjectDataSource ID="TripsDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetTrips" TypeName="TripsBLL"></asp:ObjectDataSource>
<asp:GridView ID="tripsGridView" SkinID="bigGridSkin" runat="server" AutoGenerateColumns="False" DataKeyNames="Tripno"
DataSourceID="TripsDataSource" AllowPaging="True" AllowSorting="True" PageSize="15" EmptyDataText="There Are No Trips to Display" EnableViewState="False" CellPadding="2">
<Columns>
<asp:CommandField ShowSelectButton="True" SelectText="Select" >
<ItemStyle HorizontalAlign="Center" />
</asp:CommandField>
<asp:BoundField DataField="Tripno" HeaderText="Trip #" ReadOnly="True" SortExpression="Tripno" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Warehouse" HeaderText="Whse" SortExpression="Warehouse" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Tractorno" HeaderText="Truck" SortExpression="Tractorno" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Trailerno" HeaderText="Trailer" SortExpression="Trailerno" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="TripDate" DataFormatString="{0:d}" HeaderText="Date"
HtmlEncode="False" SortExpression="TripDate" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Stops" HeaderText="Stops" SortExpression="Stops" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Weight" HeaderText="Weight" SortExpression="Weight" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Hours" HeaderText="Hours" SortExpression="Hours" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Tolls" HeaderText="Tolls" SortExpression="Tolls" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="tripsGridView" EventName="DataBinding" />
</Triggers>
</asp:UpdatePanel>
<div id="AlertDiv" class="MessageStyle">
<span id="AlertMessage"></span>
</div>
<br />
<div class="container">
<p>
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:ObjectDataSource ID="tripDetailsDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetTripDetailsByTripno" TypeName="TripDetailsBLL" DeleteMethod="DeleteTripDetail" InsertMethod="AddTripDetails" UpdateMethod="UpdateTripDetails">
<SelectParameters>
<asp:ControlParameter ControlID="tripsGridView" DefaultValue="1" Name="tripno" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="tripno" Type="String" />
<asp:Parameter Name="state" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="tripno" Type="String" />
<asp:Parameter Name="state" Type="String" />
<asp:Parameter Name="miles" Type="Decimal" />
<asp:Parameter Name="fuel" Type="Decimal" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="tripno" Type="String" />
<asp:Parameter Name="state" Type="String" />
<asp:Parameter Name="miles" Type="Decimal" />
<asp:Parameter Name="fuel" Type="Decimal" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:GridView ID="tripDetailsGridView" SkinID="filesSkin" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="Tripno" DataSourceID="tripDetailsDataSource" EnableViewState="False"
EmptyDataText="Select a Trip to Display State Mileage">
<Columns>
<asp:BoundField DataField="Tripno" HeaderText="Trip No." ReadOnly="True" SortExpression="Tripno" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="StateCode" HeaderText="State" SortExpression="StateCode" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Miles" HeaderText="Miles" SortExpression="Miles" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="Fuel" HeaderText="Fuel" SortExpression="Fuel" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
</Columns>
<EmptyDataRowStyle Wrap="False" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="tripsGridView" EventName="DataBinding" />
</Triggers>
</asp:UpdatePanel>
<br />
</p>
</div>
</div>
</asp:Content>