DaveF said:
I have a dataset with about 30 columns, I want to select 3 specific columns
of data
from that dataset to populate a datagrid. How do I do this?
Set AutoGenerateColumns to False and explicitly specify what columns to
diplay. I.e.,
<asp
ataGrid runat="server" ... AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="DataSetFieldName1" ... />
<asp:BoundColumn DataField="DataSetFieldName2" ... />
...
<asp:BoundColumn DataField="DataSetFieldNameN" ... />
</Columns>
</asp
ataGrid>
I also would implore you to read my An Extensive Examination of the
DataGrid article series, which starts at:
http://aspnet.4guysfromrolla.com/articles/040502-1.aspx
There's also my book that focuses specifically on the DataGrid,
DataList, and Repeater Web controls - ASP.NET Data Web Controls Kick
Start [
http://www.4guysfromrolla.com/ASPScripts/Goto.asp?ID=148]
--
Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
* When you think ASP.NET, think 4GuysFromRolla.com!