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.Linq to SQL: Get Comma separated (delimited) list using C# .Net<p>Please refer below sample:</p> <p><span style="text-decoration: underline;">HTML</span></p> <pre class="brush: html">&lt;div&gt; &lt;asp:GridView ID=&#34;GridView1&#34; runat=&#34;server&#34; AutoGenerateColumns=&#34;false&#34;&gt; &lt;Columns&gt; &lt;asp:BoundField HeaderText=&#34;Customer Ids&#34; DataField=&#34;CustomerIds&#34; /&gt; &lt;asp:BoundField HeaderText=&#34;Country&#34; DataField=&#34;Country&#34; /&gt; &lt;asp:BoundField HeaderText=&#34;Count of cities&#34; DataField=&#34;Count_of_cities&#34; /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/div&gt;</pre> <p><span style="text-decoration: underline;">Namespace</span></p> <pre class="brush: csharp">using System.Linq; using LINQ;</pre> <p><span style="text-decoration: underline;">C#</span></p> <pre class="brush: csharp">protected void BindGrid() { using (DataClassesDataContext dc = new DataClassesDataContext()) { var res = from c in dc.Customers group c by new { c.Country } into g select new { Country = g.Key.Country, CustomerIds = string.Join(&#34;,&#34;, g.Select(c =&gt; c.CustomerID)), Count_of_cities = g.Select(c =&gt; c.City).Count() }; GridView1.DataSource = res.ToList(); GridView1.DataBind(); } }</pre> <p><span style="text-decoration: underline;">Screenshot</span></p> <p><img src="https://i.imgur.com/pg40xKR.png" alt="" width="472" height="318" />&nbsp;</p>https://www.aspforums.net:443/Threads/157273/Linq-to-SQL-Get-Comma-separated-delimited-list-using-C-Net/https://www.aspforums.net:443/Threads/157273/Linq-to-SQL-Get-Comma-separated-delimited-list-using-C-Net/Thu, 18 Sep 2014 05:56:06 GMT