Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid Datasource confusion 1

Status
Not open for further replies.

barrylowe

Programmer
Nov 6, 2001
188
GB
I suspect there is a very simple answer to this question but I am so confused I can't see it.

I have an XML file which contains all of my Job Vacancies data. I have a dataset that is populated with all of this data usign the ReadXML method of the dataset.

I can then use this dataset as a datasource for a datagrid. That all works fine but it puts every field in my sataset as a column in my datagrid.

What I want to do now though is base my datagrid on just some of the fields in the dataset along the lines of

DataGrid1.DataSource = Select Ref, Title, Salary from dataset

Can anyone explain to me how to do this?
 
Rather than have your DataGrid automatically generate the columns, set it's AutoGenerateColumns property to False and then create a BoundField for each column.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I hadn't thought of going down that route, I was too focused on the datasource.

I'll give that a bash and see how I get on.
 
Worked like a charm, thanks very much.

Definitely a case of can't see the wood for the trees.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top