RP Nainwal
RP Nainwal

Reputation: 305

display multiple columns under the one header in grid view

I am using the grid view in asp.net and i want to show the sub columns under these headers from different table in database.

Example: Suppose Expenditure(Main header)

Date,Details,Amount(sub columns of expenditure)

and VAT,Charges,Repairs,Salary are the sub columns under Details field.

Kindly please help me. Thanks in advance.

Upvotes: 2

Views: 2174

Answers (2)

4b0
4b0

Reputation: 22323

Use the TemplateField like this

<GridView>
<Columns>
<TemplateField HeaderText="YourHeader">
<ItemTemplate>
<%# Eval("DatabaseField") %> <%# Eval("DatabaseField") %> <%# Eval("DatabaseField") %>
</ItemTemplate>
</TemplateField>
<TemplateField HeaderText="YourHeader1">
<ItemTemplate>
<%# Eval("DatabaseField") %> <%# Eval("DatabaseField") %> <%# Eval("DatabaseField") %>
</ItemTemplate>
</TemplateField>
</GridView>

Upvotes: 1

Arrabi
Arrabi

Reputation: 3768

I advice you to user a "Repeater" instead of data grid.

Upvotes: 0

Related Questions