ASP.NET Grid with CSS in Rows and Columns

Posted by user1089173 on Stack Overflow See other posts from Stack Overflow or by user1089173
Published on 2012-10-11T15:24:48Z Indexed on 2012/10/11 15:37 UTC
Read the original article Hit count: 129

Filed under:

I have the following code

List<Department> depts = new List<Department>();

Department.Add(new Department() { DNo = 1, DName = "Accounting", DFloor="6" });
Department.Add(new Department() { DNo = 2, DName = "FInance", DFloor="3" });

I want to bind this data to a GridView, so that it outputs the following. Observe the classes on each th and tr. How can I achieve this in ASP.NET?

<thead>
<tr>
 <th class="DNo">DNo</th>
 <th class="DName">DName</th>
 <th class= "DFloor">DFloor</th>
</tr>
</thead>
<tr>
 <td class="DNo">1</td>
 <td class="DName">Accounting</td>
 <td class="DFloor">6</td>
</tr>
<tr>
 <td class="DNo">2</td>
 <td class="DName">FInance</td>
 <td class="DFloor">3</td>
</tr>

© Stack Overflow or respective owner

Related posts about ASP.NET