473,544 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid Inside Repeater

Hi All,

I have a functioning datagrid on "Page 1" that displays order information
for a single order (this is for an e-commerce site). It's actually a
combination of a couple datagrids to display all of the information.

I now have a need to drop this datagrid into a repeater on "Page 2". The
repeater will grab ALL orders within a given date range and output the
datagrids for each order. Remember, the Page 1 is built to display one
order, Page 2 will be built to display ALL orders in the same fashion as
Page 1, but listing one right after the other.

Is there an easy way to take the datagrids I already have and drop them into
the ItemTemplate container of a repeater without a lot of work? I can figure
it all out if I spent the time on it, but if there's a simple way to do
this, I'd rather just ask. ;-) How do I bind the datagrids? I'd assume
within the Repeater_ItemDa taBound event I'll have to do something, but how
would that work?

Thanks,

Scott

Nov 18 '05 #1
7 1986
Scott,

You're on the right track. You should be able to copy and paste your
datagrid into the repeater. Keep it's ID the same.

Then inside the Item_DataBound event of the repeater you'll get each
datagrid like this:

Dim MyDataGrid As DataGrid = CType(e.Item.Fi ndControl("Data GridId"),
DataGrid)

"e" represents each row of the repeater.

Now you can work with the datagrid to databind it as you normally would.

MyDataGrid.Data Source = DataReader

Etc.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uV******** ******@TK2MSFTN GP12.phx.gbl...
Hi All,

I have a functioning datagrid on "Page 1" that displays order information
for a single order (this is for an e-commerce site). It's actually a
combination of a couple datagrids to display all of the information.

I now have a need to drop this datagrid into a repeater on "Page 2". The
repeater will grab ALL orders within a given date range and output the
datagrids for each order. Remember, the Page 1 is built to display one
order, Page 2 will be built to display ALL orders in the same fashion as
Page 1, but listing one right after the other.

Is there an easy way to take the datagrids I already have and drop them into the ItemTemplate container of a repeater without a lot of work? I can figure it all out if I spent the time on it, but if there's a simple way to do
this, I'd rather just ask. ;-) How do I bind the datagrids? I'd assume
within the Repeater_ItemDa taBound event I'll have to do something, but how
would that work?

Thanks,

Scott

Nov 18 '05 #2
Thank you! :)

"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Scott,

You're on the right track. You should be able to copy and paste your
datagrid into the repeater. Keep it's ID the same.

Then inside the Item_DataBound event of the repeater you'll get each
datagrid like this:

Dim MyDataGrid As DataGrid = CType(e.Item.Fi ndControl("Data GridId"),
DataGrid)

"e" represents each row of the repeater.

Now you can work with the datagrid to databind it as you normally would.

MyDataGrid.Data Source = DataReader

Etc.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uV******** ******@TK2MSFTN GP12.phx.gbl...
Hi All,

I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a
combination of a couple datagrids to display all of the information.

I now have a need to drop this datagrid into a repeater on "Page 2". The
repeater will grab ALL orders within a given date range and output the
datagrids for each order. Remember, the Page 1 is built to display one
order, Page 2 will be built to display ALL orders in the same fashion as
Page 1, but listing one right after the other.

Is there an easy way to take the datagrids I already have and drop them

into
the ItemTemplate container of a repeater without a lot of work? I can

figure
it all out if I spent the time on it, but if there's a simple way to do
this, I'd rather just ask. ;-) How do I bind the datagrids? I'd assume
within the Repeater_ItemDa taBound event I'll have to do something, but how would that work?

Thanks,

Scott


Nov 18 '05 #3
One more question. My datagrid (called 'dgCart' which is inside the
repeater) also has an ItemDataBound event. Within that event is this code:

oRows = dtDetails.Selec t("orderitem_id =" &
dgCart.DataKeys (e.Item.ItemInd ex))

Notice it references dgCart.DataKeys . Well, since dgCart now only has scope
within the ItemDataBound event for the repeater, how do I access it here?

Scott

"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Scott,

You're on the right track. You should be able to copy and paste your
datagrid into the repeater. Keep it's ID the same.

Then inside the Item_DataBound event of the repeater you'll get each
datagrid like this:

Dim MyDataGrid As DataGrid = CType(e.Item.Fi ndControl("Data GridId"),
DataGrid)

"e" represents each row of the repeater.

Now you can work with the datagrid to databind it as you normally would.

MyDataGrid.Data Source = DataReader

Etc.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uV******** ******@TK2MSFTN GP12.phx.gbl...
Hi All,

I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a
combination of a couple datagrids to display all of the information.

I now have a need to drop this datagrid into a repeater on "Page 2". The
repeater will grab ALL orders within a given date range and output the
datagrids for each order. Remember, the Page 1 is built to display one
order, Page 2 will be built to display ALL orders in the same fashion as
Page 1, but listing one right after the other.

Is there an easy way to take the datagrids I already have and drop them

into
the ItemTemplate container of a repeater without a lot of work? I can

figure
it all out if I spent the time on it, but if there's a simple way to do
this, I'd rather just ask. ;-) How do I bind the datagrids? I'd assume
within the Repeater_ItemDa taBound event I'll have to do something, but how would that work?

Thanks,

Scott


Nov 18 '05 #4
Scott,

You're welcome. If you run into any trouble feel free to email me. I wrote
that sample code from memory so if I have something wrong and you can't
figure it out let me know and I'll straighten it out. :)

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uB******** ******@TK2MSFTN GP11.phx.gbl...
Thank you! :)

"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Scott,

You're on the right track. You should be able to copy and paste your
datagrid into the repeater. Keep it's ID the same.

Then inside the Item_DataBound event of the repeater you'll get each
datagrid like this:

Dim MyDataGrid As DataGrid = CType(e.Item.Fi ndControl("Data GridId"),
DataGrid)

"e" represents each row of the repeater.

Now you can work with the datagrid to databind it as you normally would.

MyDataGrid.Data Source = DataReader

Etc.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uV******** ******@TK2MSFTN GP12.phx.gbl...
Hi All,

I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a
combination of a couple datagrids to display all of the information.

I now have a need to drop this datagrid into a repeater on "Page 2". The repeater will grab ALL orders within a given date range and output the
datagrids for each order. Remember, the Page 1 is built to display one
order, Page 2 will be built to display ALL orders in the same fashion as Page 1, but listing one right after the other.

Is there an easy way to take the datagrids I already have and drop them
into
the ItemTemplate container of a repeater without a lot of work? I can

figure
it all out if I spent the time on it, but if there's a simple way to
do this, I'd rather just ask. ;-) How do I bind the datagrids? I'd assume
within the Repeater_ItemDa taBound event I'll have to do something, but

how would that work?

Thanks,

Scott



Nov 18 '05 #5
Scott,

The datagrid won't be declared in your code-behind page so you won't have
access to it's events in order to hook up a subroutine using "Handles". But,
you can wire it up manually.

In the html view of the datagrid add "OnItemDataBoun d" along with the method
you want to fire:

This will act just like "Handles" did. (Except you don't need "Handles"
after the subroutine.)

<asp:DataGrid id="DataGrid1" runat="server"
OnItemDataBound ="MyDataGrid_It emDataBound"></asp:DataGrid>

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uw******** *****@TK2MSFTNG P11.phx.gbl...
One more question. My datagrid (called 'dgCart' which is inside the
repeater) also has an ItemDataBound event. Within that event is this code:

oRows = dtDetails.Selec t("orderitem_id =" &
dgCart.DataKeys (e.Item.ItemInd ex))

Notice it references dgCart.DataKeys . Well, since dgCart now only has scope within the ItemDataBound event for the repeater, how do I access it here?

Scott

"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Scott,

You're on the right track. You should be able to copy and paste your
datagrid into the repeater. Keep it's ID the same.

Then inside the Item_DataBound event of the repeater you'll get each
datagrid like this:

Dim MyDataGrid As DataGrid = CType(e.Item.Fi ndControl("Data GridId"),
DataGrid)

"e" represents each row of the repeater.

Now you can work with the datagrid to databind it as you normally would.

MyDataGrid.Data Source = DataReader

Etc.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uV******** ******@TK2MSFTN GP12.phx.gbl...
Hi All,

I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a
combination of a couple datagrids to display all of the information.

I now have a need to drop this datagrid into a repeater on "Page 2". The repeater will grab ALL orders within a given date range and output the
datagrids for each order. Remember, the Page 1 is built to display one
order, Page 2 will be built to display ALL orders in the same fashion as Page 1, but listing one right after the other.

Is there an easy way to take the datagrids I already have and drop them
into
the ItemTemplate container of a repeater without a lot of work? I can

figure
it all out if I spent the time on it, but if there's a simple way to
do this, I'd rather just ask. ;-) How do I bind the datagrids? I'd assume
within the Repeater_ItemDa taBound event I'll have to do something, but

how would that work?

Thanks,

Scott



Nov 18 '05 #6
Hi,

That's already been taken care of, its the reference to "dgCart" in the
dgCart's itemdatabound event that I can't figure out. Since "dgCart" is
declared in the REPEATERS itemdatabound event, it can't be accessed within
the other event because it's out of scope at that point.

Scott
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:ev******** ******@TK2MSFTN GP10.phx.gbl...
Scott,

The datagrid won't be declared in your code-behind page so you won't have
access to it's events in order to hook up a subroutine using "Handles". But, you can wire it up manually.

In the html view of the datagrid add "OnItemDataBoun d" along with the method you want to fire:

This will act just like "Handles" did. (Except you don't need "Handles"
after the subroutine.)

<asp:DataGrid id="DataGrid1" runat="server"
OnItemDataBound ="MyDataGrid_It emDataBound"></asp:DataGrid>

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uw******** *****@TK2MSFTNG P11.phx.gbl...
One more question. My datagrid (called 'dgCart' which is inside the
repeater) also has an ItemDataBound event. Within that event is this code:

oRows = dtDetails.Selec t("orderitem_id =" &
dgCart.DataKeys (e.Item.ItemInd ex))

Notice it references dgCart.DataKeys . Well, since dgCart now only has scope
within the ItemDataBound event for the repeater, how do I access it here?
Scott

"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Scott,

You're on the right track. You should be able to copy and paste your
datagrid into the repeater. Keep it's ID the same.

Then inside the Item_DataBound event of the repeater you'll get each
datagrid like this:

Dim MyDataGrid As DataGrid = CType(e.Item.Fi ndControl("Data GridId"),
DataGrid)

"e" represents each row of the repeater.

Now you can work with the datagrid to databind it as you normally would.
MyDataGrid.Data Source = DataReader

Etc.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uV******** ******@TK2MSFTN GP12.phx.gbl...
> Hi All,
>
> I have a functioning datagrid on "Page 1" that displays order

information
> for a single order (this is for an e-commerce site). It's actually a
> combination of a couple datagrids to display all of the information.
>
> I now have a need to drop this datagrid into a repeater on "Page 2". The > repeater will grab ALL orders within a given date range and output the > datagrids for each order. Remember, the Page 1 is built to display one > order, Page 2 will be built to display ALL orders in the same fashion as
> Page 1, but listing one right after the other.
>
> Is there an easy way to take the datagrids I already have and drop them into
> the ItemTemplate container of a repeater without a lot of work? I
can figure
> it all out if I spent the time on it, but if there's a simple way to

do > this, I'd rather just ask. ;-) How do I bind the datagrids? I'd assume > within the Repeater_ItemDa taBound event I'll have to do something,

but how
> would that work?
>
> Thanks,
>
> Scott
>
>
>



Nov 18 '05 #7
Scott,

Yes, I think that if you add OnItemDataBound =
"YourItemDataBo undSubroutineHe re" to the dgCart code inside of the repeater
then that subroutine should fire while dgCart is being databound.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:e2******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

That's already been taken care of, its the reference to "dgCart" in the
dgCart's itemdatabound event that I can't figure out. Since "dgCart" is
declared in the REPEATERS itemdatabound event, it can't be accessed within
the other event because it's out of scope at that point.

Scott
"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:ev******** ******@TK2MSFTN GP10.phx.gbl...
Scott,

The datagrid won't be declared in your code-behind page so you won't have
access to it's events in order to hook up a subroutine using "Handles".

But,
you can wire it up manually.

In the html view of the datagrid add "OnItemDataBoun d" along with the

method
you want to fire:

This will act just like "Handles" did. (Except you don't need "Handles"
after the subroutine.)

<asp:DataGrid id="DataGrid1" runat="server"
OnItemDataBound ="MyDataGrid_It emDataBound"></asp:DataGrid>

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Scott Schluer" <us****@webserv icesinc.biz> wrote in message
news:uw******** *****@TK2MSFTNG P11.phx.gbl...
One more question. My datagrid (called 'dgCart' which is inside the
repeater) also has an ItemDataBound event. Within that event is this code:
oRows = dtDetails.Selec t("orderitem_id =" &
dgCart.DataKeys (e.Item.ItemInd ex))

Notice it references dgCart.DataKeys . Well, since dgCart now only has

scope
within the ItemDataBound event for the repeater, how do I access it here?
Scott

"S. Justin Gengo" <sj*****@aboutf ortunate.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
> Scott,
>
> You're on the right track. You should be able to copy and paste your
> datagrid into the repeater. Keep it's ID the same.
>
> Then inside the Item_DataBound event of the repeater you'll get each
> datagrid like this:
>
> Dim MyDataGrid As DataGrid = CType(e.Item.Fi ndControl("Data GridId"),
> DataGrid)
>
> "e" represents each row of the repeater.
>
> Now you can work with the datagrid to databind it as you normally would. >
> MyDataGrid.Data Source = DataReader
>
> Etc.
>
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> Free code library at:
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzche
>
>
> "Scott Schluer" <us****@webserv icesinc.biz> wrote in message
> news:uV******** ******@TK2MSFTN GP12.phx.gbl...
> > Hi All,
> >
> > I have a functioning datagrid on "Page 1" that displays order
information
> > for a single order (this is for an e-commerce site). It's actually a > > combination of a couple datagrids to display all of the information. > >
> > I now have a need to drop this datagrid into a repeater on "Page
2". The
> > repeater will grab ALL orders within a given date range and output the > > datagrids for each order. Remember, the Page 1 is built to display one > > order, Page 2 will be built to display ALL orders in the same fashion
as
> > Page 1, but listing one right after the other.
> >
> > Is there an easy way to take the datagrids I already have and drop

them
> into
> > the ItemTemplate container of a repeater without a lot of work? I

can > figure
> > it all out if I spent the time on it, but if there's a simple way
to do
> > this, I'd rather just ask. ;-) How do I bind the datagrids? I'd

assume > > within the Repeater_ItemDa taBound event I'll have to do something, but how
> > would that work?
> >
> > Thanks,
> >
> > Scott
> >
> >
> >
>
>



Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2429
by: Lalit Bhatia | last post by:
how can we fix first column in DataGrid? Regards, Lalit Bhatia
0
1444
by: Lalit Bhatia | last post by:
thanks for the answer but I need it for windows forms. I have a desktop application where I need to implement this. -- Regards, Lalit Bhatia "Mona" <mona@discussions.microsoft.com> wrote in message news:OQ0wkCeZFHA.3220@TK2MSFTNGP14.phx.gbl... > Hi Lalit,
2
3276
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object reference not set to an instance of an object". This error message commonly occurs when a server control is incorrecly declared, so naturally I have...
1
4291
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls (watch the layout, some have child controls):
2
1785
by: News | last post by:
Hi I need help to display and edit data in a data grid within a repeater. The code is below: Sub dgrdEvents_EditCommand(sender As Object, e As DataGridCommandEventArgs) dgrdEvents.EditItemIndex = e.Item.ItemIndex BuildList() End Sub
4
1518
by: News | last post by:
I have a page with many controls. Among these controls there is a table which is a datagrid with nested repeater inside. My problem is that I can not use DataGridCommandEventArgs to get datagrid elements because submit button is not in datagrid and uses onClick event btnSaveServicePlanUpdate. Here is the code: Sub...
2
1376
by: James Moore | last post by:
I've got a datagrid. One of the elements in the grid is a comma-seperated string. I'd like to split the string and create N linkbuttons, one for each element of the string. Creating the grid with the original string isn't a problem, but I'm not sure what the best way is to create the individual linkbuttons. My first thought was to...
3
1532
by: Maziar Aflatoun | last post by:
Hi everyone, I have a datagrid that I create inside a Repeater at runtime. I have defined a checkbox beside each row so that users can select multiple rows. <asp:datagrid id="dgProducts" HorizontalAlign="Center" AutoGenerateColumns="false" CellPadding="2" runat="server" > ...... <asp:TemplateColumn HeaderText="" HeaderStyle-Width="20">...
3
5879
by: Sparky Arbuckle | last post by:
I'm sure this question has been posted many times, but I have yet to find an answer for it. I am trying to nest a repeater (or datalist) inside of a datagrid and am trying to figure out how to nest "sub-columns" inside of it. For example: Column1 ArtistName - "DiscTitle"
0
7439
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7376
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7395
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7722
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5935
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5310
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
997
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
679
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.