Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
good day everyone..
is there a way to do this in asp.net-vb? I have records in datagridview of different categories..is there a way around to add a blank row to saparate those records with 2 or 3 categories?Im trying to avoid to create a multiple gridviews of the same elements but only different queries.. thanks a lot.
Posted
Updated 11-Feb-13 19:33pm
v2

1 solution

Hi Dear,

try this but you implement your own logic

DataTable dt = new DataTable();
           dt.Columns.Add(new DataColumn("Id"));
           dt.Columns.Add(new DataColumn("Name"));
           for (int i = 0; i < 5; i++)
           {
               DataRow dr = dt.NewRow();
               if (i % 2 == 0)
               {
                   dr["Id"] = "1";
                   dr["Name"] = "Country" + i.ToString();
               }
               else
               {
                   dr["Id"] = "";
                   dr["Name"] = "";
               }
               dt.Rows.Add(dr);
           }
           this.grd.DataSource = dt;
           this.grd.DataBind();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900