I have created the sample as per your requirement
HTML:
<form id="form1" runat="server">
<div>
Repeated Rows
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" HeaderStyle-BackColor="#3AC0F2"
HeaderStyle-ForeColor="White">
<Columns>
<asp:BoundField DataField="Section" HeaderText="Section" />
<asp:BoundField DataField="Sunday" HeaderText="Sunday" />
<asp:BoundField DataField="Monday" HeaderText="Monday" />
<asp:BoundField DataField="Tuesday" HeaderText="Tuesday" />
<asp:BoundField DataField="Wednesday" HeaderText="Wednesday" />
<asp:BoundField DataField="Thursday" HeaderText="Thursday" />
<asp:BoundField DataField="Friday" HeaderText="Friday" />
<asp:BoundField DataField="Saturday" HeaderText="Saturday" />
</Columns>
</asp:GridView>
<br />
Without Repeated Rows
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" HeaderStyle-BackColor="#3AC0F2"
HeaderStyle-ForeColor="White">
<Columns>
<asp:BoundField DataField="Section" HeaderText="Section" />
<asp:BoundField DataField="Sunday" HeaderText="Sunday" />
<asp:BoundField DataField="Monday" HeaderText="Monday" />
<asp:BoundField DataField="Tuesday" HeaderText="Tuesday" />
<asp:BoundField DataField="Wednesday" HeaderText="Wednesday" />
<asp:BoundField DataField="Thursday" HeaderText="Thursday" />
<asp:BoundField DataField="Friday" HeaderText="Friday" />
<asp:BoundField DataField="Saturday" HeaderText="Saturday" />
</Columns>
</asp:GridView>
</div>
</form>
C#:
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[8]{new DataColumn("Section" ,typeof(int)),
new DataColumn("Sunday" ,typeof(string)),
new DataColumn("Monday" ,typeof(string)),
new DataColumn("Tuesday" ,typeof(string)),
new DataColumn("Wednesday" ,typeof(string)),
new DataColumn("Thursday" ,typeof(string)),
new DataColumn("Friday" ,typeof(string)),
new DataColumn("Saturday" ,typeof(string))});
dt.Rows.Add(1, "", "Ahmed", "", "", "", "", "");
dt.Rows.Add(1, "", "", "", "Ahmed", "", "", "");
dt.Rows.Add(2, "", "", "", "", "", "", "Omar");
dt.Rows.Add(3, "", "", "", "Shami", "", "", "");
this.GridView2.DataSource = dt;
this.GridView2.DataBind();
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
for (int i = 0; i < this.GridView1.Rows.Count - 2; i++)
{
GridViewRow firstRow = this.GridView1.Rows[i];
GridViewRow secondRow = this.GridView1.Rows[i + 1];
if (firstRow.Cells[0].Text == secondRow.Cells[0].Text)
{
for (int j = 1; j < firstRow.Cells.Count; j++)
{
firstRow.Cells[j].Text += secondRow.Cells[j].Text;
}
this.GridView1.Rows[secondRow.RowIndex].Visible = false;
}
}
}
Image:
Thank You.