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.Perform Button click event when user press Enterkey in TextBox inside ASP.Net ListView using jQuery<p>Hi&nbsp;<a class="username" rel="nauna">nauna,</a></p> <p>Check this example. Now please take its reference and correct your code.</p> <p>Instead of LinkBotton use Botton control.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;script type=&#34;text/javascript&#34; src=&#34;https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; function CallButtonClick(button, e) { if (e.keyCode == 13) { $(button).closest(&#39;tr&#39;).find(&#39;[id*=btnView]&#39;).trigger(&#39;click&#39;); } } &lt;/script&gt; &lt;asp:ListView ID=&#34;lvCustomers&#34; runat=&#34;server&#34; GroupPlaceholderID=&#34;groupPlaceHolder1&#34; ItemPlaceholderID=&#34;itemPlaceHolder1&#34;&gt; &lt;LayoutTemplate&gt; &lt;table cellpadding=&#34;0&#34; cellspacing=&#34;0&#34;&gt; &lt;tr&gt; &lt;th&gt; Id &lt;/th&gt; &lt;th&gt; Name &lt;/th&gt; &lt;th&gt; Country &lt;/th&gt; &lt;th&gt; City &lt;/th&gt; &lt;/tr&gt; &lt;asp:PlaceHolder runat=&#34;server&#34; ID=&#34;groupPlaceHolder1&#34;&gt;&lt;/asp:PlaceHolder&gt; &lt;/table&gt; &lt;/LayoutTemplate&gt; &lt;GroupTemplate&gt; &lt;tr&gt; &lt;asp:PlaceHolder runat=&#34;server&#34; ID=&#34;itemPlaceHolder1&#34;&gt;&lt;/asp:PlaceHolder&gt; &lt;/tr&gt; &lt;/GroupTemplate&gt; &lt;ItemTemplate&gt; &lt;td&gt; &lt;%# Eval(&#34;Id&#34;) %&gt; &lt;/td&gt; &lt;td&gt; &lt;%# Eval(&#34;Name&#34;) %&gt; &lt;/td&gt; &lt;td&gt; &lt;%# Eval(&#34;Country&#34;) %&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox runat=&#34;server&#34; ID=&#34;txtCity&#34; onkeypress=&#34;return CallButtonClick(this,event)&#34; /&gt; &lt;asp:Button Text=&#34;View&#34; runat=&#34;server&#34; ID=&#34;btnView&#34; OnClick=&#34;View&#34; /&gt; &lt;/td&gt; &lt;/ItemTemplate&gt; &lt;/asp:ListView&gt;</pre> <p><strong><span style="text-decoration: underline;">C#</span></strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { System.Data.DataTable dt = new System.Data.DataTable(); dt.Columns.AddRange(new System.Data.DataColumn[3] { new System.Data.DataColumn(&#34;Id&#34;, typeof(int)), new System.Data.DataColumn(&#34;Name&#34;, typeof(string)), new System.Data.DataColumn(&#34;Country&#34;,typeof(string)) }); dt.Rows.Add(1, &#34;John Hammond&#34;, &#34;United States&#34;); dt.Rows.Add(2, &#34;Mudassar Khan&#34;, &#34;India&#34;); dt.Rows.Add(3, &#34;Suzanne Mathews&#34;, &#34;France&#34;); dt.Rows.Add(4, &#34;Robert Schidner&#34;, &#34;Russia&#34;); this.lvCustomers.DataSource = dt; this.lvCustomers.DataBind(); } } protected void View(object sender, EventArgs e) { ClientScript.RegisterClientScriptBlock(this.GetType(), &#34;&#34;, &#34;alert(&#39;TextBox enter event occured&#39;)&#34;, true); }</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><strong><span style="text-decoration: underline;"><img src="https://i.imgur.com/YLJxOPI.gif" alt="" width="472" height="224" /></span></strong></p>https://www.aspforums.net:443/Threads/621543/Perform-Button-click-event-when-user-press-Enterkey-in-TextBox-inside-ASPNet-ListView-using-jQuery/https://www.aspforums.net:443/Threads/621543/Perform-Button-click-event-when-user-press-Enterkey-in-TextBox-inside-ASPNet-ListView-using-jQuery/Thu, 26 Apr 2018 01:14:39 GMT