asp:Calendar SelectedDate and insert data into SQL Server

gfedz
gfedz used Ask the Experts™
on
I'm using a calendar to make a request for a vehicle.  When you click on a day, a panel displays with information the user fills out.  When the user is done filling out the information, they click a submit button that inserts the information into a table on my database.  All the information transfer to the database just fine other than the dates.  Lets say the user chooses 11/2/2010 for a start date and 11/4/2010 for the end date of their request.  In the database it gets inserted as 01/01/1900.  Any ideas on how to get the correct dates?
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        <Services>
            <asp:servicereference Path="~/Calendar/AutoComplete.asmx" />
        </Services>
    </asp:ToolkitScriptManager>

    <div class="tblNWB">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                Select a GSA Vehicle:&nbsp;&nbsp;
                <asp:DropDownList ID="ddlSelect" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlSelect_OnSelectedIndexChanged">
                    <asp:ListItem Value="Blank" Text="Select Location" />
                    <asp:ListItem Value="OMS" Text="OMS-1 & 14" />
                    <asp:ListItem Value="JFHQ" Text="JFHQ & AGO" />
                    <asp:ListItem Value="New" Text="New DB" />
                </asp:DropDownList>
                <asp:DropDownList ID="ddlShow" runat="server" AutoPostBack="true" Visible="false" />
                <div>
                    <asp:Label ID="lblAccepted" runat="server" Text="Accepted" CssClass="g" />&nbsp;&nbsp;
                    <asp:Label ID="lblPending" runat="server" Text="Pending" CssClass="p" />&nbsp;&nbsp;
                    <asp:Label ID="lblCancelled" runat="server" Text="Cancelled/Denied" CssClass="d" />
                </div>

                <div style="text-align:center">
                    <asp:Calendar ID="myCal" runat="server" Height="600px" Width="900px" BorderColor="#F2F3F4" BorderWidth="3px" DayStyle-BorderWidth="1px" 
                                TodayDayStyle-BackColor="#82CAFF" NextPrevFormat="ShortMonth" SelectionMode="Day" DayHeaderStyle-Height="30px" 
                                TitleStyle-BackColor="#CBE3F0" TitleStyle-ForeColor="#153E7E" OtherMonthDayStyle-ForeColor="#B4CFEC" NextPrevStyle-ForeColor="#2554C7">
                        <DayHeaderStyle Height="30px" /><TitleStyle Height="50px" />
                        <DayStyle BorderWidth="1px" HorizontalAlign="Left" VerticalAlign="Top" />
                        <TodayDayStyle BackColor="#CBE3F0" />
                    </asp:Calendar>
                </div>
                <p>
                    <asp:Label ID="lblTest" runat="server" />
                </p>

            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ddlSelect" EventName="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="ddlShow" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
    </div>

    <asp:Panel ID="pnlSelect"  runat="server" CssClass="modalPopup" style="display:none">
        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
            <ContentTemplate>
                <asp:Button ID="btnPopDis" runat="server" style="display:none" />
                <asp:ModalPopupExtender ID="PopupTimes" runat="server" TargetControlID="btnPopDis" PopupControlID="pnlSelect" BackgroundCssClass="modalBackground" />
                <asp:Table ID="tblSelection" runat="server">
                        <asp:TableRow>
                            <asp:TableCell CssClass="tblDesc" Text="Start Date:" />
                            <asp:TableCell>
                                <asp:Label ID="lblSDate" runat="server" />
                            </asp:TableCell>
                        </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell CssClass="tblDesc" Text="End Date: " />
                        <asp:TableCell>
                            <asp:TextBox ID="txtEndDate" runat="server" Width="70" ReadOnly="true" />
                            <asp:ImageButton ID="btnCal1" runat="server" ImageUrl="~/Images/cal.gif" AlternateText="Click here to display calendar" Height="20px" Width="20px" />
                            <asp:CalendarExtender ID="CalExt" runat="server" TargetControlID="txtEndDate" PopupButtonID="btnCal1" OnClientDateSelectionChanged="checkDate" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell Text="Start Time" CssClass="tblDesc" />
                        <asp:TableCell>
                            <asp:DropDownList ID="ddlTime" runat="server">
                                <asp:ListItem Value="Morning" Text="6:00AM" />
                                <asp:ListItem Value="Afternoon" Text="11:00AM" />
                                <asp:ListItem Value="AllDay" Text="4:00PM" />
                            </asp:DropDownList>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell Text="End Time:" CssClass="tblDesc" />
                        <asp:TableCell>
                            <asp:DropDownList ID="ddlETime" runat="server">
                                <asp:ListItem Value="Morning" Text="11:00AM" Selected="True" />
                                <asp:ListItem Value="Afternoon" Text="4:00PM" />
                            </asp:DropDownList>
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell Text="Requesting For:" CssClass="tblDesc" />
                        <asp:TableCell ColumnSpan="2">
                            <asp:TextBox ID="txtDriver" runat="server" Width="250px" />
                            <asp:TextBoxWatermarkExtender ID="WtrMrkRequest" runat="server" TargetControlID="txtDriver" WatermarkText="Please enter in driver's name." WatermarkCssClass="WtrMrk" />
                            <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtDriver" ServiceMethod="FindName" 
                                MinimumPrefixLength="3" ServicePath="~/Calendar/AutoComplete.asmx" />
                            <asp:RequiredFieldValidator ID="ValReqDriver" runat="server" ErrorMessage="Driver's name." 
                                ControlToValidate="txtDriver" Text="*" CssClass="val" ValidationGroup="val" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell Text="Phone:" CssClass="tblDesc" />
                        <asp:TableCell>
                            <asp:TextBox ID="txtPhone" runat="server" Width="250px" />
                            <asp:TextBoxWatermarkExtender ID="WtrMrkPhone" runat="server" TargetControlID="txtPhone" WatermarkText="ex. 651.268.5555" WatermarkCssClass="WtrMrk" />
                        <asp:RequiredFieldValidator ID="ValReqPhone" runat="server" ErrorMessage="Phone Number ex. 555-555-5555." ControlToValidate="txtPhone"  Text="*" CssClass="val" ValidationGroup="val" />
                        <asp:RegularExpressionValidator ID="ValReqPhoneSeq" runat="server" ControlToValidate="txtPhone" Display="Static" ValidationGroup="val"
                            ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}" ErrorMessage="Phone Number ex. 555-555-5555." Text="*" CssClass="val" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell Text="E-mail:" CssClass="tblDesc" />
                        <asp:TableCell>
                            <asp:TextBox ID="txtEmail" runat="server" Width="250px" />
                            <asp:TextBoxWatermarkExtender ID="WtrMrkEmail" runat="server" TargetControlID="txtEmail" WatermarkText="ex. john.doe@us.army.mil" WatermarkCssClass="WtrMrk" />
                            <asp:RequiredFieldValidator ID="ValReqEmail" runat="server" ControlToValidate="txtEmail" ErrorMessage="AKO Email." Text="*" CssClass="val" ValidationGroup="val" />
                            <asp:RegularExpressionValidator ID="ValEmail" runat="server" ControlToValidate="txtEmail" Display="Static" ValidationGroup="val"
                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Text="*" ErrorMessage="Provide valid AKO Email." />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell Text="Unit:" CssClass="tblDesc" />
                        <asp:TableCell>
                            <asp:TextBox ID="txtUnit" runat="server" MaxLength="30" Width="250px" />
                            <asp:TextBoxWatermarkExtender ID="WtrMrkUnit" runat="server" TargetControlID="txtUnit" WatermarkText="Please enter in your unit." WatermarkCssClass="WtrMrk" />
                            <asp:RequiredFieldValidator ID="ValUnit" runat="server" ErrorMessage="Your unit." ControlToValidate="txtUnit" Text="*" CssClass="val" ValidationGroup="val" />
                        </asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell CssClass="tblDesc">
                            Description<br />of event and<br />other notes:
                        </asp:TableCell>
                        <asp:TableCell>
                            <asp:TextBox ID="txtDesc" runat="server" TextMode="MultiLine" Rows="5" Width="250px" />
                            <asp:RequiredFieldValidator ID="ValReqDesc" runat="server" ErrorMessage="Event description." ControlToValidate="txtDesc" Text="*" CssClass="val" ValidationGroup="val" />
                        </asp:TableCell>
                    </asp:TableRow>
                </asp:Table>

                <br />
                <asp:ValidationSummary ID="ValSum" runat="server" ShowMessageBox="true" ShowSummary="false" HeaderText="You must provide the following:" ValidationGroup="val" />
                <asp:LinkButton ID="lnkSubmit" runat="server" Text="Submit" ValidationGroup="val" />&nbsp;&nbsp;
                <asp:LinkButton ID="lnkCancel" runat="server" Text="Cancel" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Panel>

</asp:Content>

Open in new window

Partial Class Calendar_Calendar
    Inherits System.Web.UI.Page

    'get username for computer
    Dim myLogon As String = System.Windows.Forms.SystemInformation.UserName

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub myCal_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles myCal.DayRender
        Dim selection As Object = ddlShow.SelectedValue

        'Dates before today are blocked out from new request
        If (e.Day.Date < DateTime.Today) Then
            e.Day.IsSelectable = False
        End If

        e.Cell.Height = 100
        e.Cell.Width = 100

        'Populate calendar with with links
        If ddlSelect.SelectedValue = "Blank" Then
            e.Day.IsSelectable = False
        ElseIf ddlSelect.SelectedValue = "OMS" Then
            e.Day.IsSelectable = False

            sql = "SELECT SUBSTRING(u.strFullName,1,15) as strFullName, s.intStatusID, s.dtStartDate, s.intSchedID " _
                & "FROM **.dbo.tblSchedule AS s INNER JOIN **.dbo.tblUser AS u ON s.intPOCID = u.intID " _
                & "INNER JOIN **.dbo.tblLocation AS l ON s.intLocationID = l.intLocationID " _
                & "WHERE l.LocationDecsription = '" & selection & "' and s.dtStartDate >= DATEADD(Month, -2, getdate()) AND s.dtStartDate <= DATEADD(Month, +3, getdate())"

            myDataTable = New DataTable
            myDataTable = getData(sql)

            'Add all the rows
            For Each dr As DataRow In myDataTable.Rows
                If dr("dtStartDate") = e.Day.Date Then
                    Dim link As New LinkButton
                    If dr("intStatusID") = 1 Then
                        link.ForeColor = Drawing.Color.Gold
                    ElseIf dr("intStatusID") = 2 Then
                        link.ForeColor = Drawing.Color.Red
                    ElseIf dr("intStatusID") = 3 Then
                        link.ForeColor = Drawing.Color.Green
                    End If
                    link.OnClientClick = "javascript:window.open('PopupView.aspx?Loc=OMS&Request=" & dr("intSchedID") & "','Summary','left=450,top=300,width=500,height=400,toolbar=0,resizable=0');"
                    link.CssClass = "Curs"
                    link.Text = "<br><u>" & dr("strFullName") & "...</u>"
                    e.Cell.Controls.Add(link)
                End If
            Next

        ElseIf ddlSelect.SelectedValue = "JFHQ" Then
            e.Day.IsSelectable = False

            'In the SQL query, only get the rentals for the specific day
            sql = "SELECT SUBSTRING(u.strFullName,1,15) as strFullName, s.dtStartDate, s.intStatusID, s.intSchedID " _
                & "FROM **.dbo.tblSchedule AS s INNER JOIN **.dbo.tblUser AS u ON s.intPOCID = u.intID " _
                & "INNER JOIN **.dbo.tblLocation AS l ON s.intLocationID = l.intLocationID INNER JOIN **.dbo.tblStatus AS st ON s.intStatusID = st.intStatusID " _
                & "WHERE l.LocationDecsription = '" & selection & "' and s.dtStartDate >= DATEADD(Month, -2, getdate()) AND s.dtStartDate <= DATEADD(Month, +3, getdate())"

            myDataTable = New DataTable
            myDataTable = getData(sql)

            'Add all the rows
            For Each dr As DataRow In myDataTable.Rows
                If dr("dtStartDate") = e.Day.Date Then
                    Dim link As New LinkButton
                    If dr("intStatusID") = 1 Then
                        link.ForeColor = Drawing.Color.Gold
                    ElseIf dr("intStatusID") = 2 Then
                        link.ForeColor = Drawing.Color.Red
                    ElseIf dr("intStatusID") = 3 Then
                        link.ForeColor = Drawing.Color.Green
                    End If
                    link.OnClientClick = "javascript:window.open('PopupView.aspx?Loc=JFHQ&Request=" & dr("intSchedID") & "','Summary','left=450,top=300,width=500,height=400,toolbar=0,resizable=0');"
                    link.CssClass = "Curs"
                    link.Text = "<br><u>" & dr("strFullName") & "...</u>"
                    e.Cell.Controls.Add(link)
                End If
            Next

        ElseIf ddlSelect.SelectedValue = "New" Then

            If ddlShow.SelectedIndex = "0" Then
                e.Day.IsSelectable = False

                sql = "SELECT SUBSTRING(gv.strVehicle,1,15) as strVehicle, s.dtStartDate, s.bitAccepted, s.bitPending, s.bitDenied, s.intSchedID " _
                    & "FROM tblSchedule AS s INNER JOIN tblVehicleReference AS vr ON s.intVehRefID = vr.intVehRefID " _
                    & "INNER JOIN tblGSAVehicles AS gv ON vr.intVehicleID = gv.intVehicleID " _
                    & "WHERE s.dtStartDate >= DATEADD(Month, -2, getdate()) AND s.dtStartDate <= DATEADD(Month, +3, getdate())"

                myDataTable = New DataTable
                myDataTable = getData(sql)

            Else
                Dim SelShow As Object = ddlShow.SelectedValue

                sql = "SELECT SUBSTRING(gv.strVehicle,1,15) as strVehicle, s.dtStartDate, s.bitAccepted, s.bitPending, s.bitDenied, s.intSchedID " _
                    & "FROM tblSchedule AS s INNER JOIN tblVehicleReference AS vr ON s.intVehRefID = vr.intVehRefID " _
                    & "INNER JOIN tblGSAVehicles AS gv ON vr.intVehicleID = gv.intVehicleID " _
                    & "WHERE s.dtStartDate >= DATEADD(Month, -2, getdate()) AND s.dtStartDate <= DATEADD(Month, +3, getdate()) " _
                    & "AND vr.intVehRefID = '" & SelShow & "'"

                myDataTable = New DataTable
                myDataTable = getData(sql)

            End If

            'Add all the rows
            For Each dr As DataRow In myDataTable.Rows
                If dr("dtStartDate") = e.Day.Date Then
                    Dim link As New LinkButton
                    link.OnClientClick = "javascript:window.open('PopupView.aspx?Loc=New&Request=" & dr("intSchedID") & "','Summary','left=450,top=300,width=500,height=400,toolbar=0,resizable=0');"
                    link.CssClass = "Curs"
                    link.Text = "<br><u>" & dr("strVehicle") & "...</u>"
                    If dr("bitPending") = "1" Then
                        link.ForeColor = Drawing.Color.Gold
                    ElseIf dr("bitDenied") = "1" Then
                        link.ForeColor = Drawing.Color.Red
                    ElseIf dr("bitAccepted") = "1" Then
                        link.ForeColor = Drawing.Color.Green
                    End If
                    e.Cell.Controls.Add(link)
                End If
            Next
        End If


        'post date in panel, x-page value
        If e.Day.IsSelected Then
            lblSDate.Text = e.Day.Date
            txtEndDate.Text = e.Day.Date
            ddlTime.SelectedIndex = 0
            ddlETime.SelectedIndex = 0
            txtDesc.Text = ""
            LoadRequest()
        End If

    End Sub

    Protected Sub ddlSelect_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlSelect.SelectedIndexChanged
        'decide which information to view
        If ddlSelect.SelectedValue = "OMS" Then
            ddlShow.Items.Clear()
            ddlShow.Visible = True

            sql = "Select LocationDecsription From **.dbo.tblLocation Where rental = '0' Order By LocationDecsription"

            myDataTable = New DataTable
            myDataTable = getData(sql)

            ddlShow.Items.Add(New ListItem("", "0"))
            buildDD(sql, ddlShow)

        ElseIf ddlSelect.SelectedValue = "JFHQ" Then
            ddlShow.Items.Clear()
            ddlShow.Visible = True

            sql = "SELECT l.LocationDecsription FROM **.dbo.tblLocation as l WHERE rental = '0' Order By LocationDecsription"

            myDataTable = New DataTable
            myDataTable = getData(sql)

            ddlShow.Items.Add(New ListItem("", "0"))
            buildDD(sql, ddlShow)

        ElseIf ddlSelect.SelectedValue = "New" Then
            ddlShow.Items.Clear()
            ddlShow.Visible = True

            sql = "SELECT vr.intVehRefID, RTRIM(vl.strLocation) + ' > ' + RTRIM(gv.strVehicle) AS Vehicles " _
                & "FROM tblVehicleReference AS vr INNER JOIN tblVehicleLocations AS vl ON vr.intLocID = vl.intLocID " _
                & "INNER JOIN tblGSAVehicles as gv ON vr.intVehicleID = gv.intVehicleID ORDER BY gv.strVehicle"

            myDataTable = New DataTable
            myDataTable = getData(sql)

            For Each DataRow In myDataTable.Rows
                ddlShow.Items.Add(New ListItem(DataRow("Vehicles"), DataRow("intVehRefID")))
            Next
        Else
            ddlShow.Visible = False
        End If

        If ddlShow.SelectedIndex = 0 Then
            ddlShow.SelectedItem.Text = "Select Vehicle"
        End If

        Session("ddlSelect") = ddlSelect.SelectedIndex
    End Sub

    Protected Sub ddlShow_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlShow.SelectedIndexChanged
        Session("ddlShow") = ddlShow.SelectedIndex
    End Sub

    Protected Sub LoadRequest()

        'display name from db
        sql = "select case when strFullName is null then '' else strfullname end from **.dbo.tblUser where strLogon = '" & myLogon & "'"

        myDataTable = New DataTable
        myDataTable = getData(sql)

        If myDataTable.Rows.Count = 0 Then
            txtDriver.Text = WtrMrkRequest.WatermarkText
        Else
            txtDriver.Text = myDataTable.Rows(0)(0)
        End If

        'display phone from db
        sql = "select case when strPrimaryPhone is null then '' else  REPLACE(strPrimaryPhone, '.', '-') end from **.dbo.tblUser where strLogon = '" & myLogon & "'"

        myDataTable = New DataTable
        myDataTable = getData(sql)

        If myDataTable.Rows.Count = 0 Then
            txtPhone.Text = WtrMrkPhone.WatermarkText
        Else
            txtPhone.Text = myDataTable.Rows(0)(0)
        End If

        'display email from db
        sql = "select case when strEmail is null then '' else strEmail end from **.dbo.tblUser where strLogon = '" & myLogon & "'"

        myDataTable = New DataTable
        myDataTable = getData(sql)

        If myDataTable.Rows.Count = 0 Then
            txtEmail.Text = WtrMrkEmail.WatermarkText
        Else
            txtEmail.Text = myDataTable.Rows(0)(0)
        End If

    'display unit from db
        sql = "select case when strFullTimeOrg is null then '' else strFullTimeOrg end from **.dbo.tblUser where strLogon = '" & myLogon & "'"

        myDataTable = New DataTable
        myDataTable = getData(sql)

        If myDataTable.Rows.Count = 0 Then
            txtUnit.Text = WtrMrkUnit.WatermarkText
        Else
            txtUnit.Text = myDataTable.Rows(0)(0)
        End If
    End Sub

    Protected Sub myCal_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles myCal.SelectionChanged
        'pnl shows
        PopupTimes.Show()
    End Sub

    Protected Sub lnkSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkSubmit.Click

        sql = "SELECT intID FROM **.dbo.tblUser WHERE strFullName = '" & txtDriver.Text & "'"

        myDataTable = New DataTable
        myDataTable = getData(sql)

        Dim DriverID As Integer = myDataTable.Rows(0)(0)

        sql = "INSERT	INTO tblSchedule (intDriverID, dtDriverReq, intVehRefID, dtStartDate, dtEndDate, tStartTime, tEndTime, " _
            & "strDescription, bitAccepted, bitPending, bitDenied) " _
            & "VALUES ('" & DriverID & "', '" & Date.Today & "', '" & ddlShow.SelectedValue & "', '" & lblSDate.Text & "', '" & txtEndDate.Text & "', " _
            & "'" & ddlTime.SelectedItem.Text & "', '" & ddlETime.SelectedItem.Text & "', '" & txtDesc.Text & "', 'false', 'true', 'false')"

        insertUpdateDelete(sql)

    End Sub
End Class

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
This question was asked by someone earlier today, please read this post and see if you can apply it.  If not, let me know and I'll try to walk you through it.

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_26557323.html

Commented:
once remove ReadOnly="true" for txtEndDate and check the results

<asp:TextBox ID="txtEndDate" runat="server" Width="70" ReadOnly="true" />

To check whether date sent is in correct format or not

Select Convert(Nvarchar(11),Cast('11/2/2010' as DateTime),1), IsDate('11/2/2010')

Author

Commented:
vinodch - Taking out ReadOnly="True" did work in getting the date but it also made it possible for user to type into the text box which I do not want.  The format of the calendar selected day does cross over into my database correctly.

ChetOS82 - That post would help more if I was doing my error checking as that user is doing it but that's not how mine is set up.  I realize now that when I do the sql query that I am getting no value passed over.  Like I said to vinodch, the textbox will give me the text if I take off the ReadOnly but I cannot do that for this application.  I could change it to a label but then I would still be in the same boat as the other date that doesn't show.  

For what ever reason, the dates that are selected will cross over to a review/request panel but will not save the value to the database.  There in lies my problem.
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Commented:
I have the textbox working now with the ReadOnly="true"

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        txtEndDate.Text = Request(txtEndDate.UniqueID)

 End Sub

Commented:
What is the point of the textbox exactly?  Is it simply so you have a place to stick the value from the calendar, or do you want it displayed to the user?  What you are doing with Request(txtEndDate.UniqueID) is just a hack, you shouldn't have to do that.

Try doing it like this if you just want to use the textbox as a data holder.

<asp:TextBox ID="txtEndDate" runat="server" Width="70" Style="display:none;" />
Commented:
Just to distinguish to the user that it is a field that can/should be altered if needed.  Something that the user can see.  But I want to force them to use the calendar to select their date so the formatting works nice with the sql server.

Author

Commented:
Since no one is seeming to respond to this post or has stopped helping.  I'm just closing the post...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial