User-1174608757 posted
Hi JagjitSingh
According to your description,I have made a sample here. I suggest you to use unpivot in sqlserver to change the columns to rows.
Here is my code,I hope it can help you.
Structure database:

Gridview.aspx:
head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"></asp:GridView>
</div>
</form>
</body>
Gridview.aspx.cs:
public partial class gridview : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string sql = "select code,name,namevalue from structure unpivot (namevalue for name in (Name1, Name2, Name3) ) unpiv";
string conStr = ConfigurationManager.ConnectionStrings["mssqlserver"].ConnectionString;
DataTable dt = new DataTable();
using (SqlDataAdapter adapter = new SqlDataAdapter(sql, conStr))
{
adapter.Fill(dt);
}
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}
}
}
It shows as below

Best Regards
Wei Zhang