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 focus on TextBox inside Bootstrap Modal Popup inside ASP.Net UpdatePanel using jQuery<p>Hi <a class="username" rel="arehman"> arehman</a>,</p> <p>Refer below sample.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">&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; src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js&#34;&gt;&lt;/script&gt; &lt;link rel=&#34;stylesheet&#34; href=&#34;http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css&#34; /&gt; &lt;script type=&#34;text/javascript&#34;&gt; function ShowPopup() { $(&#39;#myModal&#39;).modal(&#39;show&#39;); $(&#39;#myModal&#39;).on(&#39;shown.bs.modal&#39;, function () { $(&#39;#txtUserName&#39;).focus(); }); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=&#34;form1&#34; runat=&#34;server&#34;&gt; &lt;asp:ScriptManager runat=&#34;server&#34;&gt; &lt;/asp:ScriptManager&gt; &lt;asp:UpdatePanel runat=&#34;server&#34;&gt; &lt;ContentTemplate&gt; &lt;div&gt; &lt;br /&gt; &lt;asp:Button Text=&#34;Show Popup&#34; runat=&#34;server&#34; ID=&#34;btnShowPopup&#34; class=&#34;btn btn-info btn-lg&#34; OnClientClick=&#34;ShowPopup()&#34; OnClick=&#34;btnShowPopup_Click&#34; /&gt; &lt;div class=&#34;modal fade&#34; id=&#34;myModal&#34; tabindex=&#34;-1&#34; role=&#34;dialog&#34; aria-labelledby=&#34;myModalLabel&#34;&gt; &lt;div class=&#34;modal-dialog&#34; role=&#34;document&#34;&gt; &lt;div class=&#34;modal-content&#34;&gt; &lt;div class=&#34;modal-header&#34;&gt; &lt;button type=&#34;button&#34; class=&#34;close&#34; data-dismiss=&#34;modal&#34; aria-label=&#34;Close&#34;&gt; &lt;span aria-hidden=&#34;true&#34;&gt;&amp;times;&lt;/span&gt;&lt;/button&gt; &lt;h4 class=&#34;modal-title&#34; id=&#34;myModalLabel&#34;&gt; Modal title&lt;/h4&gt; &lt;/div&gt; &lt;div class=&#34;modal-body&#34;&gt; &lt;input type=&#34;textusername&#34; id=&#34;txtUserName&#34; class=&#34;form-control&#34; style=&#34;width: 300px&#34; name=&#34;name&#34; value=&#34;&#34; /&gt; &lt;/div&gt; &lt;div class=&#34;modal-footer&#34;&gt; &lt;button type=&#34;button&#34; class=&#34;btn btn-default&#34; data-dismiss=&#34;modal&#34;&gt; Close&lt;/button&gt; &lt;button type=&#34;button&#34; class=&#34;btn btn-primary&#34;&gt; Save changes&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void btnShowPopup_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript((sender as Control), this.GetType(), &#34;Popup&#34;, &#34;ShowPopup();&#34;, true); }</pre> <p><strong>&nbsp;VB.Net</strong></p> <pre class="brush: vb">Protected Sub btnShowPopup_Click(sender As Object, e As System.EventArgs) ScriptManager.RegisterStartupScript(CType(sender, Control), Me.GetType(), &#34;Popup&#34;, &#34;ShowPopup();&#34;, True) End Sub </pre> <p><span style="text-decoration: underline;"><strong>Screenshot</strong></span></p> <p><span style="text-decoration: underline;"><strong><img src="https://imgur.com/fg7K8PQ.gif" alt="" width="344" height="275" /></strong></span></p>https://www.aspforums.net:443/Threads/416859/Set-focus-on-TextBox-inside-Bootstrap-Modal-Popup-inside-ASPNet-UpdatePanel-using-jQuery/https://www.aspforums.net:443/Threads/416859/Set-focus-on-TextBox-inside-Bootstrap-Modal-Popup-inside-ASPNet-UpdatePanel-using-jQuery/Wed, 13 Mar 2019 05:04:46 GMT