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.Bind WebGrid with dynamic Columns using jQuery AJAX and JSON in ASP.Net MVC<blockquote><cite>Shud says:</cite> <div class="line number53 index52 alt2"><code class="csharp spaces">&nbsp;</code><code class="csharp plain">var grid = $(</code><code class="csharp string">'#WebGrid'</code><code class="csharp plain">).GetHtml();</code></div> <div class="line number54 index53 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">grid.dataSource.data(resultAssignment);</code></div> <div class="line number55 index54 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">grid.refresh();</code></div> </blockquote> <p>You can't assign the dataSource to WebGrid.</p> <p>To populate the WebGrid using JSON Ajax refer below article.</p> <h1 class="header"><a title="Populate (Bind) WebGrid from database using jQuery AJAX and JSON in ASP.Net MVC'a" href="https://www.aspsnippets.com/Articles/Populate-Bind-WebGrid-from-database-using-jQuery-AJAX-and-JSON-in-ASPNet-MVC.aspx">Populate (Bind) WebGrid from database using jQuery AJAX and JSON in ASP.Net MVC</a></h1>https://www.aspforums.net:443/Threads/504234/Bind-WebGrid-with-dynamic-Columns-using-jQuery-AJAX-and-JSON-in-ASPNet-MVC/https://www.aspforums.net:443/Threads/504234/Bind-WebGrid-with-dynamic-Columns-using-jQuery-AJAX-and-JSON-in-ASPNet-MVC/Wed, 26 Dec 2018 23:06:12 GMT