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 MKB TimePicker time using JavaScript<p>Hi <a class="username" rel="suraj@123"> suraj@123</a>,</p> <p>Using the below article i have created the example.</p> <h1 class="header"><a title="TimePicker control in ASP.Net with example'a" href="https://www.aspsnippets.com/Articles/TimePicker-control-in-ASPNet-with-example.aspx">TimePicker control in ASP.Net with example</a></h1> <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;%@ Register Assembly=&#34;TimePicker&#34; Namespace=&#34;MKB.TimePicker&#34; TagPrefix=&#34;cc1&#34; %&gt; &lt;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&gt; &lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head runat=&#34;server&#34;&gt; &lt;title&gt;&lt;/title&gt; &lt;script type=&#34;text/javascript&#34;&gt; function SetTime() { var timeSelector = document.getElementById(&#34;timeSelector&#34;); var inputs = timeSelector.getElementsByTagName(&#34;input&#34;); if (inputs.length === 6) { inputs[0].value = &#34;04&#34;; inputs[2].value = &#34;10&#34;; inputs[5].value = &#34;PM&#34;; } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&#34;form1&#34; runat=&#34;server&#34;&gt; &lt;asp:ScriptManager ID=&#34;ScriptManager1&#34; runat=&#34;server&#34;&gt; &lt;/asp:ScriptManager&gt; &lt;cc1:TimeSelector ID=&#34;timeSelector&#34; runat=&#34;server&#34;&gt; &lt;/cc1:TimeSelector&gt; &lt;br /&gt; &lt;input type=&#34;button&#34; name=&#34;setName&#34; value=&#34;Set Time&#34; onclick=&#34;SetTime()&#34; /&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:Button ID=&#34;btnSubmit&#34; runat=&#34;server&#34; Text=&#34;Get Time&#34; OnClick=&#34;GetTime&#34; /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void GetTime(object sender, EventArgs e) { DateTime time = DateTime.Parse(string.Format(&#34;{0}:{1}:{2} {3}&#34;, timeSelector.Hour, timeSelector.Minute, timeSelector.Second, timeSelector.AmPm)); ClientScript.RegisterStartupScript(this.GetType(), &#34;time&#34;, &#34;alert(&#39;Selected Time: &#34; + time.ToString(&#34;hh:mm:ss tt&#34;) + &#34;&#39;);&#34;, true); }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub GetTime(sender As Object, e As EventArgs) Dim time As DateTime = DateTime.Parse(String.Format(&#34;{0}:{1}:{2} {3}&#34;, timeSelector.Hour, timeSelector.Minute, timeSelector.Second, timeSelector.AmPm)) ClientScript.RegisterStartupScript(Me.[GetType](), &#34;time&#34;, &#34;alert(&#39;Selected Time: &#34; + time.ToString(&#34;hh:mm:ss tt&#34;) + &#34;&#39;);&#34;, True) End Sub</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><img src="https://i.imgur.com/3H9Ez3N.gif" alt="" width="250" height="186" /></p>https://www.aspforums.net:443/Threads/131487/Set-MKB-TimePicker-time-using-JavaScript/https://www.aspforums.net:443/Threads/131487/Set-MKB-TimePicker-time-using-JavaScript/Tue, 24 Apr 2018 03:38:36 GMT