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.Change ASP.Net GridView Caption Text using jQuery<p>Hi&nbsp;jmontano,</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;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 () { $(&#39;[id*=btnCaption]&#39;).on(&#39;click&#39;, function () { $(&#39;[id*=GridView1] caption&#39;).html(&#34;&lt;b&gt;&#34; + $(&#39;[id*=txtCaption]&#39;).val() + &#34;&lt;/b&gt;&#34;); return false; }); }); &lt;/script&gt; &lt;asp:GridView ID=&#34;GridView1&#34; runat=&#34;server&#34; AutoGenerateColumns=&#34;false&#34; Caption=&#34;&lt;b&gt;Customers&lt;/b&gt;&#34;&gt; &lt;Columns&gt; &lt;asp:BoundField DataField=&#34;Id&#34; HeaderText=&#34;Id&#34; /&gt; &lt;asp:BoundField DataField=&#34;Name&#34; HeaderText=&#34;Name&#34; /&gt; &lt;asp:BoundField DataField=&#34;Country&#34; HeaderText=&#34;Country&#34; /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;br /&gt; &lt;asp:TextBox ID=&#34;txtCaption&#34; runat=&#34;server&#34; /&gt; &lt;asp:Button ID=&#34;btnCaption&#34; Text=&#34;Change Caption&#34; runat=&#34;server&#34; /&gt;</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <p><strong>C#</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;); GridView1.DataSource = dt; GridView1.DataBind(); } }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If Not Me.IsPostBack Then Dim dt As System.Data.DataTable = New System.Data.DataTable() dt.Columns.AddRange(New System.Data.DataColumn(2) { New System.Data.DataColumn(&#34;Id&#34;, GetType(Integer)), New System.Data.DataColumn(&#34;Name&#34;, GetType(String)), New System.Data.DataColumn(&#34;Country&#34;, GetType(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;) GridView1.DataSource = dt GridView1.DataBind() End If End Sub</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/euqI1dG.gif" alt="" width="287" height="199" /></span></strong></p>https://www.aspforums.net:443/Threads/180074/Change-ASPNet-GridView-Caption-Text-using-jQuery/https://www.aspforums.net:443/Threads/180074/Change-ASPNet-GridView-Caption-Text-using-jQuery/Thu, 01 Aug 2019 03:21:04 GMT