Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > What if <itemtemplate> does correlate to 1 row in dataset?

Reply
Thread Tools

What if <itemtemplate> does correlate to 1 row in dataset?

 
 
Ben Becker
Guest
Posts: n/a
 
      04-28-2004
I am trying to build a custom crosstab type of grid where I take some items
in a data grid and based on the content of the current item compared to the
previous item, determine if a new row in a table should be created or not.
In order to do this, I need to have full control over the conditional logic
for how items get displayed within a repeater element which I'm not seeing
as possible.

How can I cursor through a data set, apply conditional logic to it as I do
to customize how it is outputed to the screen? The repeater, datagrid and
data list seem great if your query comes back in a table structure where
each record correlates to an item, but if you have 10 records that relate to
a single "item" then I'm lost on how to get it to look like 1 item.

Thanks,
Ben



 
Reply With Quote
 
 
 
 
Jeff
Guest
Posts: n/a
 
      04-28-2004
You don't tell us if you're using ADO.NET - so I'll assume you are because
that would make a lot of sense in .NET programming. If you're not using
ADO.NET, then you should tell us what you are using...

<<<How can I cursor through a data set, >>>
You don't - at least not in the traditional sense of a "cursor" (MoveNext,
MovePrior, Move N are just not part of the ADO.NET game). Rather the ADO.NET
DataSet is comprised of a collection of DataRow objects - so you navigate
through the collection just like you'd navigate any other collection.

The Datagrid, datalist, and repeater are generally designed to be bound to
something (e.g, DataTable) that pretty much already contains what needs to
be presented in the UI. So, one of your options is this:
1. Create a brand new and empty DataTable (or DataSet) in your code (create
it out of thin air - this is not your grand father's ADO). Your complicated
custom logic can add new DataRow objects as necessary. So, the sequence of
events would be something like this: (1) you retrieve your initial DataSet
("uncross-tabbed" data) from your data source, and (2) run it through your
custom logic - which (3) outputs a new DataSet/DataTable. You then (4) bind
your repeater control (DataList, DataGrid, DataRepeater) to the output
DataSet/DataTable.

Jeff





"Ben Becker" <> wrote in message
news:...
> I am trying to build a custom crosstab type of grid where I take some

items
> in a data grid and based on the content of the current item compared to

the
> previous item, determine if a new row in a table should be created or not.
> In order to do this, I need to have full control over the conditional

logic
> for how items get displayed within a repeater element which I'm not seeing
> as possible.
>
> How can I cursor through a data set, apply conditional logic to it as I do
> to customize how it is outputed to the screen? The repeater, datagrid and
> data list seem great if your query comes back in a table structure where
> each record correlates to an item, but if you have 10 records that relate

to
> a single "item" then I'm lost on how to get it to look like 1 item.
>
> Thanks,
> Ben
>
>
>



 
Reply With Quote
 
 
 
 
Ben Becker
Guest
Posts: n/a
 
      04-28-2004
Thank you for the reply. Yes, I am using ADO.NET and I think I understand
what you are saying. The repeater wants it already formatted so if it
isn't, I'll have to build a custom data set and then bind it to the repeater
(or even the data grid for that matter since it should suffice).

Thank you again for the quick reply!
Ben

"Jeff" <> wrote in message
news:%...
> You don't tell us if you're using ADO.NET - so I'll assume you are because
> that would make a lot of sense in .NET programming. If you're not using
> ADO.NET, then you should tell us what you are using...
>
> <<<How can I cursor through a data set, >>>
> You don't - at least not in the traditional sense of a "cursor" (MoveNext,
> MovePrior, Move N are just not part of the ADO.NET game). Rather the

ADO.NET
> DataSet is comprised of a collection of DataRow objects - so you navigate
> through the collection just like you'd navigate any other collection.
>
> The Datagrid, datalist, and repeater are generally designed to be bound to
> something (e.g, DataTable) that pretty much already contains what needs to
> be presented in the UI. So, one of your options is this:
> 1. Create a brand new and empty DataTable (or DataSet) in your code

(create
> it out of thin air - this is not your grand father's ADO). Your

complicated
> custom logic can add new DataRow objects as necessary. So, the sequence of
> events would be something like this: (1) you retrieve your initial DataSet
> ("uncross-tabbed" data) from your data source, and (2) run it through your
> custom logic - which (3) outputs a new DataSet/DataTable. You then (4)

bind
> your repeater control (DataList, DataGrid, DataRepeater) to the output
> DataSet/DataTable.
>
> Jeff
>
>
>
>
>
> "Ben Becker" <> wrote in message
> news:...
> > I am trying to build a custom crosstab type of grid where I take some

> items
> > in a data grid and based on the content of the current item compared to

> the
> > previous item, determine if a new row in a table should be created or

not.
> > In order to do this, I need to have full control over the conditional

> logic
> > for how items get displayed within a repeater element which I'm not

seeing
> > as possible.
> >
> > How can I cursor through a data set, apply conditional logic to it as I

do
> > to customize how it is outputed to the screen? The repeater, datagrid

and
> > data list seem great if your query comes back in a table structure where
> > each record correlates to an item, but if you have 10 records that

relate
> to
> > a single "item" then I'm lost on how to get it to look like 1 item.
> >
> > Thanks,
> > Ben
> >
> >
> >

>
>



 
Reply With Quote
 
Jeff
Guest
Posts: n/a
 
      04-28-2004
<<<I'll have to build a custom data set and then bind it to the repeater
> (or even the data grid for that matter since it should suffice)>>>


Exactly. And I'll add that if the data is read-only (which cross-tab data
inherently is), then you might want to use a Repeater or DataList control
rather than a DataGrid - reason being that the DataGrid is not as
light-weight as the Repeater or DataList, and you won't need all the
features possible in the DataGrid. You bind to a DataList or Repeater just
as you would a DataGrid.
For assistance in chosing how to best display your cross-tab DataSet, check
out the following link:
http://msdn.microsoft.com/library/de...ebcontrols.asp

What you will most likely *not* be doing is programmatically adding a new
row to the grid, and then assigning cell values (as was the case with some
of the old COM grids in Windows Client applications (ah, those were the
days!). In the new world you prepare your data in a clean DataSet or
DataTable, behind the scenes, and then bind to whatever control will be
displaying it.

Good Luck.




"Ben Becker" <> wrote in message
news:...
> Thank you for the reply. Yes, I am using ADO.NET and I think I understand
> what you are saying. The repeater wants it already formatted so if it
> isn't, I'll have to build a custom data set and then bind it to the

repeater
> (or even the data grid for that matter since it should suffice).
>
> Thank you again for the quick reply!
> Ben
>
> "Jeff" <> wrote in message
> news:%...
> > You don't tell us if you're using ADO.NET - so I'll assume you are

because
> > that would make a lot of sense in .NET programming. If you're not using
> > ADO.NET, then you should tell us what you are using...
> >
> > <<<How can I cursor through a data set, >>>
> > You don't - at least not in the traditional sense of a "cursor"

(MoveNext,
> > MovePrior, Move N are just not part of the ADO.NET game). Rather the

> ADO.NET
> > DataSet is comprised of a collection of DataRow objects - so you

navigate
> > through the collection just like you'd navigate any other collection.
> >
> > The Datagrid, datalist, and repeater are generally designed to be bound

to
> > something (e.g, DataTable) that pretty much already contains what needs

to
> > be presented in the UI. So, one of your options is this:
> > 1. Create a brand new and empty DataTable (or DataSet) in your code

> (create
> > it out of thin air - this is not your grand father's ADO). Your

> complicated
> > custom logic can add new DataRow objects as necessary. So, the sequence

of
> > events would be something like this: (1) you retrieve your initial

DataSet
> > ("uncross-tabbed" data) from your data source, and (2) run it through

your
> > custom logic - which (3) outputs a new DataSet/DataTable. You then (4)

> bind
> > your repeater control (DataList, DataGrid, DataRepeater) to the output
> > DataSet/DataTable.
> >
> > Jeff
> >
> >
> >
> >
> >
> > "Ben Becker" <> wrote in message
> > news:...
> > > I am trying to build a custom crosstab type of grid where I take some

> > items
> > > in a data grid and based on the content of the current item compared

to
> > the
> > > previous item, determine if a new row in a table should be created or

> not.
> > > In order to do this, I need to have full control over the conditional

> > logic
> > > for how items get displayed within a repeater element which I'm not

> seeing
> > > as possible.
> > >
> > > How can I cursor through a data set, apply conditional logic to it as

I
> do
> > > to customize how it is outputed to the screen? The repeater, datagrid

> and
> > > data list seem great if your query comes back in a table structure

where
> > > each record correlates to an item, but if you have 10 records that

> relate
> > to
> > > a single "item" then I'm lost on how to get it to look like 1 item.
> > >
> > > Thanks,
> > > Ben
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
correlate ASP page with timings of its DB calls likong@email.com ASP General 0 07-07-2007 12:02 AM
i need to correlate between 2 dim' binary matrixes - Is there any library? liav.ezer@gmail.com C++ 2 05-22-2006 02:17 PM
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 PM
How to add a new row to a datagrid with values of the selected row =?Utf-8?B?U3VyZXNo?= ASP .Net 1 11-22-2004 09:04 AM
Referencing Dataset row not Datagrid row Craig ASP .Net 2 11-02-2004 05:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57