DataColumns

  • Thread starter Thread starter Paperback Writer
  • Start date Start date
P

Paperback Writer

Hi Folks,
I would like to know how can i specify columns in my DataGrid manually ?
I have a proc that is binding my DataGrid with 15 columns and i want just
some of these columns, how can i ?

Thanks in advance
 
Hi,
First you have to set the autogeneratecolumns property to false for the
datagrid. then you can add columns in the aspx file or in the code behind
file.

code for aspx
<Columns>
<asp:BoundColumn DataField="[colname]" HeaderText="nameforthecol">
</asp:BoundColumn>
</columns>
or in code behind like

Dim bcTemp As BoundColumn = new BoundColumn
bcTemp.DataField = "[colname]"
bcTemp.HeaderText = "nameforthecol"
dgFileList.Columns.Add(bcTemp)
 

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

Back
Top