|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Hello,
I have a Datareader with 2 fields from the database in it. I would like to use the DataGrid to display them. This I can do. If the DataReader has 4 rows in it I would like to display the records in 2 DataGrid rows. So I would have the following: ColHeader1 ColHeader2 ColHeader1 ColHeader2 Field1(0) Field2(0) Field1(1) Field2(1) Field1(2) Field2(2) Field1(3) Field2(3) Is this possible with the DataGrid? If so could you please point me in the right direction? I have tried everything I can think of. Thanks unwantedspam wrote:
Show quoteHide quote > Hello, Its possible but not so simple, for each datagrid item you'll need to > I have a Datareader with 2 fields from the database in it. I would like > > to use the DataGrid to display them. This I can do. If the DataReader > has 4 rows in it I would like to display the records in 2 DataGrid > rows. So I would have the following: > > > ColHeader1 ColHeader2 ColHeader1 ColHeader2 > Field1(0) Field2(0) Field1(1) Field2(1) > Field1(2) Field2(2) Field1(3) Field2(3) > > > Is this possible with the DataGrid? If so could you please point me in > the right direction? I have tried everything I can think of. > > > Thanks > handle the OnItemDataBound event, then customise your field in the event handler. -- Rob Schieber unwantedspam wrote:
> Thanks for you reply. The difficulty is in the fact that you are essentially trying to > > Would it be easier with a repeater? > override the default databinding behavior. This will require that in the OnItemDataBound event you cast the appropriate value in e.Item.Data item, and change the appropriate text in your datagridItem Cell. It shouldn't be too hard if you are familliar w/ the datagrid control. -- Rob Schieber
Other interesting topics
Application_Start Question
Resources and class libraries ViewState: why? Using Validation controls to check for NON NUMERIC input. (This should be easy!) Allow multiple image swap onmouseover Help: Why <mobile:label> doesn't render HTML tag? ASP.NET 2.0 ICallbackEventHandler Login Control used with existing database how forum post's stored in database? (which data type)? temporary file |
|||||||||||||||||||||||