ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Set Date in TextBox when TextMode is Date using C# and VB.Net in ASP.Net<p>Hi <a class="username" rel="itsme"> itsme</a>,</p> <p>TextBox with TextMode Date only supports the yyyy-MM-dd format.</p> <p>So you need to set the date format before assigning it to TextBox.</p> <p>The browsers that do not support TextMode Date will show as 2019-08-13, but on browsers that support it will display accordingly.</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;asp:TextBox runat=&#34;server&#34; ID=&#34;Apply&#34; TextMode=&#34;Date&#34; /&gt;</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">Apply.Text = DateTime.Now.AddDays(5).ToString(&#34;yyyy-MM-dd&#34;);</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb"> Apply.Text = DateTime.Now.AddDays(5).ToString(&#34;yyyy-MM-dd&#34;)</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><img src="https://i.imgur.com/JmchZAA.jpg" alt="" width="276" height="243" /></p>https://www.aspforums.net:443/Threads/100041/Set-Date-in-TextBox-when-TextMode-is-Date-using-C-and-VBNet-in-ASPNet/https://www.aspforums.net:443/Threads/100041/Set-Date-in-TextBox-when-TextMode-is-Date-using-C-and-VBNet-in-ASPNet/Thu, 08 Aug 2019 05:02:52 GMTSet Date in TextBox when TextMode is Date using C# and VB.Net in ASP.Net<p>I found the answer</p> <p>here is the working code.</p> <pre class="brush: html">&lt;tr&gt; &lt;td&gt;&lt;b&gt;Last Date of Apply:&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;asp:TextBox ID=&#34;Apply&#34; runat=&#34;server&#34; Width=&#34;250px&#34; type=&#34;Date&#34; Height=&#34;32px&#34;&gt;&lt;/asp:TextBox&gt;&lt;/td&gt; &lt;/tr&gt;</pre> <p>&nbsp;</p> <pre class="brush: csharp">string conv = (grow.FindControl(&#34;lblapply&#34;) as Label).Text; conv = DateTime.Parse(conv).ToString(&#34;yyyy-MM-dd&#34;); Apply.Text = conv.ToString();</pre> <p>&nbsp;</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/100041/Set-Date-in-TextBox-when-TextMode-is-Date-using-C-and-VBNet-in-ASPNet/https://www.aspforums.net:443/Threads/100041/Set-Date-in-TextBox-when-TextMode-is-Date-using-C-and-VBNet-in-ASPNet/Thu, 08 Aug 2019 22:49:17 GMT