Display selected fields in datagrid

A

anand

Hello group,

I using a datagrid to display output of a query, now the problem is that it
displays all column of query in columns of grid, ( e. g.)is it possible that
i fetch Employee name ,age and salary and i display only name and age..

Thanks

Andy
 
M

Martin Marinov

You have to use AutogenerateColumns = False and define the columns that you
want to display
e.g.

<asp:datagrid autogeneratecolumn=false runat="server" id="dg">
<Columns>
<asp:BoundColumn DataField="EmployeeName" />
<asp:BoundColumn DataField="Age" />
<asp:BoundColumn DataField="Salary" Visible="false" />
</Columns>
</asp:daatgrid>

Regards
Martin
 
A

anand

Thanks Martin....

Regards,

Anand

Martin Marinov said:
You have to use AutogenerateColumns = False and define the columns that you
want to display
e.g.

<asp:datagrid autogeneratecolumn=false runat="server" id="dg">
<Columns>
<asp:BoundColumn DataField="EmployeeName" />
<asp:BoundColumn DataField="Age" />
<asp:BoundColumn DataField="Salary" Visible="false" />
</Columns>
</asp:daatgrid>

Regards
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top