Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > gridview formatting

Reply
Thread Tools

gridview formatting

 
 
John
Guest
Posts: n/a
 
      06-07-2006
On my gridview I need to group the sales by year.
2000 - 2001 - 2002, etc is there a way to do this with using the gridview?

example:
sales for: 2000
data
blank row
sales for: 2001
data
blank row

now the data that is being pulled back to populate the grid is the year



 
Reply With Quote
 
 
 
 
Bruno Alexandre
Guest
Posts: n/a
 
      06-07-2006
of course you can...

<asp:GridView id="gv2003" ...
<br />
<asp:GridView id="gv2002" ...
<br />
<asp:GridView id="gv2001" ...
<br />
<asp:GridView id="gv2000" ...


and populate each grid view with the data you want, you could even have a
function that returns a datatable and in page_load statmente you should
write something like:

gv2003.DataSource = loadData("2003")
gv2003.DataBind()
gv2002.DataSource = loadData("2002")
gv2002.DataBind()
gv2001.DataSource = loadData("2001")
gv2001.DataBind()
gv2000.DataSource = loadData("2000")
gv2000.DataBind()


because to add a blank row to your GV you need to use OnRowCreate statement
from the GV, and then you need to separate the data from years, it could
give you more work than the simple I showed you above...

....if you have a problem about time consuming, because you are getting
values from the DB 4 times, you could do that once and populate a datatable
and then using DataTable filtering you can sort the data through the 4
individual GV's
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


"John" <(E-Mail Removed)> escreveu na mensagem
news:%(E-Mail Removed)...
> On my gridview I need to group the sales by year.
> 2000 - 2001 - 2002, etc is there a way to do this with using the gridview?
>
> example:
> sales for: 2000
> data
> blank row
> sales for: 2001
> data
> blank row
>
> now the data that is being pulled back to populate the grid is the year
>
>
>



 
Reply With Quote
 
 
 
 
John
Guest
Posts: n/a
 
      06-07-2006
ah, no. I'm not having anywhere from 1 to 20 grids on my page.
could this be done easier using a datagrid instead of the gridview?

"Bruno Alexandre" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> of course you can...
>
> <asp:GridView id="gv2003" ...
> <br />
> <asp:GridView id="gv2002" ...
> <br />
> <asp:GridView id="gv2001" ...
> <br />
> <asp:GridView id="gv2000" ...
>
>
> and populate each grid view with the data you want, you could even have a
> function that returns a datatable and in page_load statmente you should
> write something like:
>
> gv2003.DataSource = loadData("2003")
> gv2003.DataBind()
> gv2002.DataSource = loadData("2002")
> gv2002.DataBind()
> gv2001.DataSource = loadData("2001")
> gv2001.DataBind()
> gv2000.DataSource = loadData("2000")
> gv2000.DataBind()
>
>
> because to add a blank row to your GV you need to use OnRowCreate
> statement from the GV, and then you need to separate the data from years,
> it could give you more work than the simple I showed you above...
>
> ...if you have a problem about time consuming, because you are getting
> values from the DB 4 times, you could do that once and populate a
> datatable and then using DataTable filtering you can sort the data through
> the 4 individual GV's
> --
>
> Bruno Alexandre
> (a Portuguese in Københanv, Danmark)
>
>
> "John" <(E-Mail Removed)> escreveu na mensagem
> news:%(E-Mail Removed)...
>> On my gridview I need to group the sales by year.
>> 2000 - 2001 - 2002, etc is there a way to do this with using the
>> gridview?
>>
>> example:
>> sales for: 2000
>> data
>> blank row
>> sales for: 2001
>> data
>> blank row
>>
>> now the data that is being pulled back to populate the grid is the year
>>
>>
>>

>
>



 
Reply With Quote
 
Bruno Alexandre
Guest
Posts: n/a
 
      06-07-2006
GridView is way better than DataGrid... just remember that GridView is the
2nd version of the DataGrid in .NET 1.x

you could still do the same as I mencionated, use the GV_RowCreate and
separate your data.
--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


"John" <(E-Mail Removed)> escreveu na mensagem
news:Oql%(E-Mail Removed)...
> ah, no. I'm not having anywhere from 1 to 20 grids on my page.
> could this be done easier using a datagrid instead of the gridview?
>
> "Bruno Alexandre" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> of course you can...
>>
>> <asp:GridView id="gv2003" ...
>> <br />
>> <asp:GridView id="gv2002" ...
>> <br />
>> <asp:GridView id="gv2001" ...
>> <br />
>> <asp:GridView id="gv2000" ...
>>
>>
>> and populate each grid view with the data you want, you could even have a
>> function that returns a datatable and in page_load statmente you should
>> write something like:
>>
>> gv2003.DataSource = loadData("2003")
>> gv2003.DataBind()
>> gv2002.DataSource = loadData("2002")
>> gv2002.DataBind()
>> gv2001.DataSource = loadData("2001")
>> gv2001.DataBind()
>> gv2000.DataSource = loadData("2000")
>> gv2000.DataBind()
>>
>>
>> because to add a blank row to your GV you need to use OnRowCreate
>> statement from the GV, and then you need to separate the data from years,
>> it could give you more work than the simple I showed you above...
>>
>> ...if you have a problem about time consuming, because you are getting
>> values from the DB 4 times, you could do that once and populate a
>> datatable and then using DataTable filtering you can sort the data
>> through the 4 individual GV's
>> --
>>
>> Bruno Alexandre
>> (a Portuguese in Københanv, Danmark)
>>
>>
>> "John" <(E-Mail Removed)> escreveu na mensagem
>> news:%(E-Mail Removed)...
>>> On my gridview I need to group the sales by year.
>>> 2000 - 2001 - 2002, etc is there a way to do this with using the
>>> gridview?
>>>
>>> example:
>>> sales for: 2000
>>> data
>>> blank row
>>> sales for: 2001
>>> data
>>> blank row
>>>
>>> now the data that is being pulled back to populate the grid is the year
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
John
Guest
Posts: n/a
 
      06-07-2006
how would I seperate the data though? I'm getting the year back in the
dataset thats populating the grid. So how can i read that row/column that
has the year and break it apart and show the data pertaining to that year?


"Bruno Alexandre" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> GridView is way better than DataGrid... just remember that GridView is the
> 2nd version of the DataGrid in .NET 1.x
>
> you could still do the same as I mencionated, use the GV_RowCreate and
> separate your data.
> --
>
> Bruno Alexandre
> (a Portuguese in Københanv, Danmark)
>
>
> "John" <(E-Mail Removed)> escreveu na mensagem
> news:Oql%(E-Mail Removed)...
>> ah, no. I'm not having anywhere from 1 to 20 grids on my page.
>> could this be done easier using a datagrid instead of the gridview?
>>
>> "Bruno Alexandre" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> of course you can...
>>>
>>> <asp:GridView id="gv2003" ...
>>> <br />
>>> <asp:GridView id="gv2002" ...
>>> <br />
>>> <asp:GridView id="gv2001" ...
>>> <br />
>>> <asp:GridView id="gv2000" ...
>>>
>>>
>>> and populate each grid view with the data you want, you could even have
>>> a function that returns a datatable and in page_load statmente you
>>> should write something like:
>>>
>>> gv2003.DataSource = loadData("2003")
>>> gv2003.DataBind()
>>> gv2002.DataSource = loadData("2002")
>>> gv2002.DataBind()
>>> gv2001.DataSource = loadData("2001")
>>> gv2001.DataBind()
>>> gv2000.DataSource = loadData("2000")
>>> gv2000.DataBind()
>>>
>>>
>>> because to add a blank row to your GV you need to use OnRowCreate
>>> statement from the GV, and then you need to separate the data from
>>> years, it could give you more work than the simple I showed you above...
>>>
>>> ...if you have a problem about time consuming, because you are getting
>>> values from the DB 4 times, you could do that once and populate a
>>> datatable and then using DataTable filtering you can sort the data
>>> through the 4 individual GV's
>>> --
>>>
>>> Bruno Alexandre
>>> (a Portuguese in Københanv, Danmark)
>>>
>>>
>>> "John" <(E-Mail Removed)> escreveu na mensagem
>>> news:%(E-Mail Removed)...
>>>> On my gridview I need to group the sales by year.
>>>> 2000 - 2001 - 2002, etc is there a way to do this with using the
>>>> gridview?
>>>>
>>>> example:
>>>> sales for: 2000
>>>> data
>>>> blank row
>>>> sales for: 2001
>>>> data
>>>> blank row
>>>>
>>>> now the data that is being pulled back to populate the grid is the year
>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Riki
Guest
Posts: n/a
 
      06-08-2006
Google is your friend:
http://www.google.com/search?q=gridview+grouping

If you're prepared to do some modifications from DataGrid to GridView,
there's a lot more to find about DataGrid grouping.

--

Riki

"John" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> On my gridview I need to group the sales by year.
> 2000 - 2001 - 2002, etc is there a way to do this with using the gridview?
>
> example:
> sales for: 2000
> data
> blank row
> sales for: 2001
> data
> blank row
>
> now the data that is being pulled back to populate the grid is the year
>
>
>



 
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
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
Gridview Item formatting washoetech ASP .Net 3 09-30-2005 01:06 AM
Formatting gridview rows based on data Not Me ASP .Net 0 09-23-2005 12:03 PM
GridView Formatting sck10 ASP .Net 5 10-18-2004 01:30 AM
Need formatting options menu for formatting hard drive Mark T. Computer Support 3 11-24-2003 11:50 PM



Advertisments