|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ASP.net datagrid with more than 1 datasourceIs it possible to build a datagrid with one column having test1 as a datasource and another column having test2 as a datasource: string[] test1 = new string[]{"1", "2", "3"}; string[] test2 = new string[]{"John", "Marc", "Tom"}; I just want a table that looks like this: 1 John 2 Marc 3 Tom Is this possible with a WebDatagrid or do i have to use another object? Regards Jim When data binding, the grid can only cope wiht one data source at a time.
You'll have to merge your two data sources into one. -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > Hi > > Is it possible to build a datagrid with one column having test1 as a > datasource and another column having test2 as a datasource: string[] > test1 = new string[]{"1", "2", "3"}; > > string[] test2 = new string[]{"John", "Marc", "Tom"}; > > I just want a table that looks like this: > > 1 John > > 2 Marc > > 3 Tom > > Is this possible with a WebDatagrid or do i have to use another > object? > > Regards > > Jim > > When data binding, the grid can only cope wiht one data source at a Or the other thing you could do is to manually iterate over your datasources > time. You'll have to merge your two data sources into one. and manually build the Grid. -Brock DevelopMentor http://staff.develop.com/ballen It looks like you are using two distinct arrays to store related
information. IMO it would be really better to have an array with structures or classes in such a case. Not only it should solve the problem (plus for example if you want to sort or whatever else it will be easier to have a "row of data" in each cell rather than having n array each one storing just a column). Patrice -- Show quoteHide quote"Jimmy" <bef***@gmail.com> a écrit dans le message de news:uI7g9EMcFHA.3184@TK2MSFTNGP15.phx.gbl... > Hi > > Is it possible to build a datagrid with one column having test1 as a > datasource and another column having test2 as a datasource: > string[] test1 = new string[]{"1", "2", "3"}; > > string[] test2 = new string[]{"John", "Marc", "Tom"}; > > > > I just want a table that looks like this: > > > > 1 John > > 2 Marc > > 3 Tom > > > > Is this possible with a WebDatagrid or do i have to use another object? > > > > Regards > > > > Jim > >
Custom Controls & Javascript
DataGrid with edititemtemplate What happened to Alignment property? Another basic question: How to call and show one Web Form from another Web Form? RadioButton in 2 GroupNames? Specifying Width and Height properties as percentages navigate through multipage ListBox not firing SelectedIndexChanged (AutoPostBack=True) Event Handling Question Problems with ListBox Control |
|||||||||||||||||||||||