Aniket Narvankar

Aniket Narvankar

  • 559
  • 2.1k
  • 608.2k

Dot Net

Oct 28 2015 5:30 AM
I have a DataTable
Name
A
B
C
D
E
F
G
column name is Name
Normally if we display output would be
A
B
C
D
E
F
G
I want the out put to be
A B
C D
E F
G
That is two row values on single row.
I have tried this
Response.Write("<htmL>");
Response.Write("<head>");
Response.Write("</head>");
Response.Write("<title>");
Response.Write("</title>");
Response.Write("<body>");
Response.Write("<table>")
for(int i = 0;i<dt.Rows.Count;i=i+2)
{
Response.Write("<tr>");
Response.Write("<td>");
Response.Write(dt.Rows[i]["Name"].ToString());
Response.Write(dt.Rows[i + 1]["Name"].ToString());
Response.Write("</tD>");
Response.Write("</tr>");
}
Response.Write("</table>");
Response.Write("</body>");
Response.Write("</html>");
It works fine for even values but odd value of datatable.row.count it creates problems,I am stuck on this.please do let me know about this how to do this
Thanks
Regards,
Aniket Narvankar

Answers (1)