Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!

Is there a way to use 2 different datasources in one datagrid?

i want one source to bind to the headers in my datagrid

and the other source to bind to the rows?

is it possible to do this, does anyone have an example?

Thanks!
Posted

Hello Dear,

For the header there is no use of using a different datasource. You can use your datasource to bind the data it will take automatically the dataset header name as the header. If you want not to show some columns then you can hide it by the hidden property in row_intialization event.
 
Share this answer
 
Comments
CrafterIt 29-Aug-11 6:32am    
Hi!

I need the header to be displayed, but the headername is dynamic and changes from day to day. i cannot use autogenerated column names because it's static.
I soved it by changing all the column headers in the code behind, i would prefered to solve it with data binding but anyway it works.

C#
this.datagridname.Columns[0].header = "headertext";


I just change the headertext on all my columns this with the string from my datasource.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900