Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Bind Ajax Calender Extender to database ?

$
0
0

I am using ajax calender exterder to pick date and month to my database , but some how , i cant bind the calender externder to my database 

i got this error : 

String was not recognized as a valid DateTime.

here is my code ,can you help me out ?

<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Select Date:<asp:TextBox ID="DateQualifiedTextBox" Text='<%#Bind("DateQualified" , "{0: MM/dd/yyyy}") %>'  runat="server" ReadOnly="true" Height="21px" Width="200px" ></asp:TextBox>&nbsp;&nbsp;&nbsp;&nbsp;<asp:ImageButton ID="imgPopup" runat="server" ImageAlign="Bottom" 
                ImageUrl="images/calendar.png" /><cc1:CalendarExtender ID="DateQualifiedTextBox_CalendarExtender" runat="server" Format="dd/MM/yyyy" 
                PopupButtonID="imgPopup" TargetControlID="DateQualifiedTextBox"></cc1:CalendarExtender>
Dim dt As DateTime = DateTime.ParseExact(DateQualifiedTextBox.Text, "dd/MM/yyyy", Nothing).ToString("MM/dd/yyyy")
 Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
        Dim insertSql As String = "INSERT INTO Tbbooking(Date) VALUES(@Date)"
        Using myConnection As New SqlConnection(connectionString)
            myConnection.Open()
            Dim myCommand As New SqlCommand(insertSql, myConnection)
            myCommand.Parameters.AddWithValue("@Date", dt)


            myCommand.ExecuteNonQuery()
            myConnection.Close()
            Response.Redirect("Confirmation.aspx")
        End Using

Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>