Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to cast String to DateTime
    primarykey
    data
    text
    <p>I've following TextBox with ajax calender extender and on TextChanged event I am calling <strong>"txtFromDate_TextChanged"</strong> function.</p> <p><strong>asp code:</strong></p> <pre><code>&lt;asp:TextBox ID="txtFromDate" runat="server" AutoPostBack="True" ontextchanged="txtFromDate_TextChanged"&gt;&lt;/asp:TextBox&gt; asp:CalendarExtender ID="txtFromDate_CalendarExtender" Format="dd/MM/yyyy" runat="server" Enabled="True" TargetControlID="txtFromDate"&gt; &lt;/asp:CalendarExtender&gt; </code></pre> <p><strong>c# code:</strong></p> <pre><code>protected void txtFromDate_TextChanged(object sender, EventArgs e) { if (txtFromDate.Text != "") { DateTime fromdate = Convert.ToDateTime(txtFromDate.Text); Query = Query + "And CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, ord_del_date))) &gt;= '" + fromdate.ToString("yyyy'-'MM'-'dd") + "'"; } } </code></pre> <p>This code is working all fine when i debug through visual studio and even when I host the site on my local IIS server. The problem is that when I host the site on my <strong>online hosting server</strong> and when I pick a date from calender and calls a textchanged event it gives following error:</p> <p><strong>Error:</strong></p> <pre><code>String was not recognized as a valid DateTime. </code></pre> <p>I know it is giving error because of line:</p> <pre><code>DateTime fromdate = Convert.ToDateTime(txtFromDate.Text); </code></pre> <p>But I am not finding anything wrong in this code. This code is working perfectly fine from visual studio or when hosted on IIS but I am totally confused why it isn't working when hosted on hosting server. I am totally confused. Please help me out.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload