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_ItemDataBound event I'll have to do something, but how
would that work?
Thanks,
Scott 7 1854
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.FindControl("DataGridId"),
DataGrid)
"e" represents each row of the repeater.
Now you can work with the datagrid to databind it as you normally would.
MyDataGrid.DataSource = 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****@webservicesinc.biz> wrote in message
news:uV**************@TK2MSFTNGP12.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_ItemDataBound event I'll have to do something, but how would that work?
Thanks,
Scott
Thank you! :)
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:%2****************@TK2MSFTNGP09.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.FindControl("DataGridId"), DataGrid)
"e" represents each row of the repeater.
Now you can work with the datagrid to databind it as you normally would.
MyDataGrid.DataSource = 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****@webservicesinc.biz> wrote in message news:uV**************@TK2MSFTNGP12.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_ItemDataBound event I'll have to do something, but
how would that work?
Thanks,
Scott
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.Select("orderitem_id=" &
dgCart.DataKeys(e.Item.ItemIndex))
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*****@aboutfortunate.com> wrote in message
news:%2****************@TK2MSFTNGP09.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.FindControl("DataGridId"), DataGrid)
"e" represents each row of the repeater.
Now you can work with the datagrid to databind it as you normally would.
MyDataGrid.DataSource = 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****@webservicesinc.biz> wrote in message news:uV**************@TK2MSFTNGP12.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_ItemDataBound event I'll have to do something, but
how would that work?
Thanks,
Scott
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****@webservicesinc.biz> wrote in message
news:uB**************@TK2MSFTNGP11.phx.gbl... Thank you! :)
"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message news:%2****************@TK2MSFTNGP09.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.FindControl("DataGridId"), DataGrid)
"e" represents each row of the repeater.
Now you can work with the datagrid to databind it as you normally would.
MyDataGrid.DataSource = 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****@webservicesinc.biz> wrote in message news:uV**************@TK2MSFTNGP12.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_ItemDataBound event I'll have to do something, but
how would that work?
Thanks,
Scott
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 "OnItemDataBound" 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_ItemDataBound"></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****@webservicesinc.biz> wrote in message
news:uw*************@TK2MSFTNGP11.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.Select("orderitem_id=" & dgCart.DataKeys(e.Item.ItemIndex))
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*****@aboutfortunate.com> wrote in message news:%2****************@TK2MSFTNGP09.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.FindControl("DataGridId"), DataGrid)
"e" represents each row of the repeater.
Now you can work with the datagrid to databind it as you normally would.
MyDataGrid.DataSource = 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****@webservicesinc.biz> wrote in message news:uV**************@TK2MSFTNGP12.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_ItemDataBound event I'll have to do something, but
how would that work?
Thanks,
Scott
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*****@aboutfortunate.com> wrote in message
news:ev**************@TK2MSFTNGP10.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 "OnItemDataBound" 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_ItemDataBound"></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****@webservicesinc.biz> wrote in message news:uw*************@TK2MSFTNGP11.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.Select("orderitem_id=" & dgCart.DataKeys(e.Item.ItemIndex))
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*****@aboutfortunate.com> wrote in message news:%2****************@TK2MSFTNGP09.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.FindControl("DataGridId"), DataGrid)
"e" represents each row of the repeater.
Now you can work with the datagrid to databind it as you normally
would. MyDataGrid.DataSource = 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****@webservicesinc.biz> wrote in message news:uV**************@TK2MSFTNGP12.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_ItemDataBound event I'll have to do something,
but how > would that work? > > Thanks, > > Scott > > >
Scott,
Yes, I think that if you add OnItemDataBound =
"YourItemDataBoundSubroutineHere" 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****@webservicesinc.biz> wrote in message
news:e2**************@TK2MSFTNGP09.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*****@aboutfortunate.com> wrote in message news:ev**************@TK2MSFTNGP10.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 "OnItemDataBound" 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_ItemDataBound"></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****@webservicesinc.biz> wrote in message news:uw*************@TK2MSFTNGP11.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.Select("orderitem_id=" & dgCart.DataKeys(e.Item.ItemIndex))
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*****@aboutfortunate.com> wrote in message news:%2****************@TK2MSFTNGP09.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.FindControl("DataGridId"), > DataGrid) > > "e" represents each row of the repeater. > > Now you can work with the datagrid to databind it as you normally would. > > MyDataGrid.DataSource = 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****@webservicesinc.biz> wrote in message > news:uV**************@TK2MSFTNGP12.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_ItemDataBound event I'll have to do something, but how > > would that work? > > > > Thanks, > > > > Scott > > > > > > > >
This discussion thread is closed Replies have been disabled for this discussion. Similar topics
1 post
views
Thread by Lalit Bhatia |
last post: by
|
reply
views
Thread by Lalit Bhatia |
last post: by
|
2 posts
views
Thread by Stephen Miller |
last post: by
|
1 post
views
Thread by Rick |
last post: by
|
2 posts
views
Thread by News |
last post: by
|
4 posts
views
Thread by News |
last post: by
|
2 posts
views
Thread by James Moore |
last post: by
|
3 posts
views
Thread by Maziar Aflatoun |
last post: by
|
3 posts
views
Thread by Sparky Arbuckle |
last post: by
| | | | | | | | | | |