473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Repeater problem ...

Hi all. I have an array of objects (Let's call it Object A) and each of
these objects has an array of other objects (Let's call these Object B) in
it. I can successfully repeat through Object A's and for each Object A I
can successfully repeat Object B's that are in it, like so:

Object A-1
Object B-1-A-1
Object B-2-A-1
Object B-3-A-1
Object A-2
Object B-1-A-2
Object B-2-A-2
Object A-3
Object B-1-A-3
Object B-2-A-3
etc ...

I am placing a button beside each Object B so the user can delete that
Object if they chose. My problem is that I cannot identify (in code) which
Object A the user wants to delete from? I am using the following code:

asp:Repeater ID="objectARepeater" Runat="server"
<stuff>
asp:Repeater ID="objectBRepeater" Runat="server"
<stuff>
a href="MyCode.aspx?mode=deleteObjectB&ObjectBId=<%#
DataBinder.Eval(Container.DataItem, "ObjectBId")
%>&ObjectAId='ObjectAId"><img align="absBottom" border="0" alt="Delete
ObjectB Item" src="images/delx.gif"></a
/asp:Repeater
/asp:Repeater

I have ObjectBId in the ObjectB object, but I do not store ObjectAId in the
ObjectB object, this value is in ObjectA. I need this value so I know which
ObjectA to delete the ObjectB from.

How do I reference the ObjectAId from the ObjectA while in the ObjectB
repeater?

--
Thanks,
Th**********@gmail.com
--
Nov 19 '05 #1
4 1439
I forgot the DataSource for the ObjectB repeater, I have added it below.

--
Thanks,
Th**********@gmail.com
--
"TheBurgerMan" <Th**********@gmail.com> wrote in message
news:um*************@TK2MSFTNGP09.phx.gbl...
Hi all. I have an array of objects (Let's call it Object A) and each of
these objects has an array of other objects (Let's call these Object B) in
it. I can successfully repeat through Object A's and for each Object A I
can successfully repeat Object B's that are in it, like so:

Object A-1
Object B-1-A-1
Object B-2-A-1
Object B-3-A-1
Object A-2
Object B-1-A-2
Object B-2-A-2
Object A-3
Object B-1-A-3
Object B-2-A-3
etc ...

I am placing a button beside each Object B so the user can delete that
Object if they chose. My problem is that I cannot identify (in code)
which Object A the user wants to delete from? I am using the following
code:

asp:Repeater ID="objectARepeater" Runat="server"
<stuff>
asp:Repeater ID="objectBRepeater" Runat="server" DataSource='<%#
DataBinder.Eval(Container.DataItem,"ObjectBs") %>'>
<stuff>
a href="MyCode.aspx?mode=deleteObjectB&ObjectBId=<%#
DataBinder.Eval(Container.DataItem, "ObjectBId")
%>&ObjectAId='ObjectAId"><img align="absBottom" border="0" alt="Delete
ObjectB Item" src="images/delx.gif"></a
/asp:Repeater
/asp:Repeater

I have ObjectBId in the ObjectB object, but I do not store ObjectAId in
the ObjectB object, this value is in ObjectA. I need this value so I know
which ObjectA to delete the ObjectB from.

How do I reference the ObjectAId from the ObjectA while in the ObjectB
repeater?

--
Thanks,
Th**********@gmail.com
--

Nov 19 '05 #2
Well, you could certainly walk up the control tree and get the parent
ItemTemplate's DataItem...ala:

<%# ((Object A)((RepeaterItem)Container.Parent.Parent).DataItem ).ObjectAId%>
but that seems offly unreadable and easily breakable...why not put a
refernece to ObjectB's parant in ObjectB ?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"TheBurgerMan" <Th**********@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I forgot the DataSource for the ObjectB repeater, I have added it below.

--
Thanks,
Th**********@gmail.com
--
"TheBurgerMan" <Th**********@gmail.com> wrote in message
news:um*************@TK2MSFTNGP09.phx.gbl...
Hi all. I have an array of objects (Let's call it Object A) and each of
these objects has an array of other objects (Let's call these Object B) in it. I can successfully repeat through Object A's and for each Object A I can successfully repeat Object B's that are in it, like so:

Object A-1
Object B-1-A-1
Object B-2-A-1
Object B-3-A-1
Object A-2
Object B-1-A-2
Object B-2-A-2
Object A-3
Object B-1-A-3
Object B-2-A-3
etc ...

I am placing a button beside each Object B so the user can delete that
Object if they chose. My problem is that I cannot identify (in code)
which Object A the user wants to delete from? I am using the following
code:

asp:Repeater ID="objectARepeater" Runat="server"
<stuff>
asp:Repeater ID="objectBRepeater" Runat="server" DataSource='<%#
DataBinder.Eval(Container.DataItem,"ObjectBs") %>'>
<stuff>
a href="MyCode.aspx?mode=deleteObjectB&ObjectBId=<%#
DataBinder.Eval(Container.DataItem, "ObjectBId")
%>&ObjectAId='ObjectAId"><img align="absBottom" border="0" alt="Delete
ObjectB Item" src="images/delx.gif"></a
/asp:Repeater
/asp:Repeater

I have ObjectBId in the ObjectB object, but I do not store ObjectAId in
the ObjectB object, this value is in ObjectA. I need this value so I know which ObjectA to delete the ObjectB from.

How do I reference the ObjectAId from the ObjectA while in the ObjectB
repeater?

--
Thanks,
Th**********@gmail.com
--


Nov 19 '05 #3
Thanks Karl. That is the missing piece I needed. I did not want to add a
lot of references in my base objects as they could be in different parent
objects. With your code I can access the data in the sub-repeater without
adding more to my objects.

Works great.
--
Thanks,
TheBurgerMan
at
gmail.com
--
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uU**************@TK2MSFTNGP10.phx.gbl...
Well, you could certainly walk up the control tree and get the parent
ItemTemplate's DataItem...ala:

<%# ((Object
A)((RepeaterItem)Container.Parent.Parent).DataItem ).ObjectAId%>
but that seems offly unreadable and easily breakable...why not put a
refernece to ObjectB's parant in ObjectB ?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"TheBurgerMan" <Th**********@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I forgot the DataSource for the ObjectB repeater, I have added it below.

--
Thanks,
Th**********@gmail.com
--
"TheBurgerMan" <Th**********@gmail.com> wrote in message
news:um*************@TK2MSFTNGP09.phx.gbl...
> Hi all. I have an array of objects (Let's call it Object A) and each
> of
> these objects has an array of other objects (Let's call these Object B) in > it. I can successfully repeat through Object A's and for each Object A I > can successfully repeat Object B's that are in it, like so:
>
> Object A-1
> Object B-1-A-1
> Object B-2-A-1
> Object B-3-A-1
> Object A-2
> Object B-1-A-2
> Object B-2-A-2
> Object A-3
> Object B-1-A-3
> Object B-2-A-3
> etc ...
>
> I am placing a button beside each Object B so the user can delete that
> Object if they chose. My problem is that I cannot identify (in code)
> which Object A the user wants to delete from? I am using the following
> code:
>
> asp:Repeater ID="objectARepeater" Runat="server"
> <stuff>
> asp:Repeater ID="objectBRepeater" Runat="server" DataSource='<%#
> DataBinder.Eval(Container.DataItem,"ObjectBs") %>'>
> <stuff>
> a href="MyCode.aspx?mode=deleteObjectB&ObjectBId=<%#
> DataBinder.Eval(Container.DataItem, "ObjectBId")
> %>&ObjectAId='ObjectAId"><img align="absBottom" border="0" alt="Delete
> ObjectB Item" src="images/delx.gif"></a
> /asp:Repeater
> /asp:Repeater
>
> I have ObjectBId in the ObjectB object, but I do not store ObjectAId in
> the ObjectB object, this value is in ObjectA. I need this value so I know > which ObjectA to delete the ObjectB from.
>
> How do I reference the ObjectAId from the ObjectA while in the ObjectB
> repeater?
>
> --
> Thanks,
> Th**********@gmail.com
> --
>
>



Nov 19 '05 #4
It's a pretty ugly piece of code...atleast consider using a function that
calls into better-documented codebehind:

<%# GetParentId(Container) %>

protected function GetParentId(container as RepeaterItem) as string
dim repeater as control = container.Parent
dim parentItem as RepeaterItem = ctype(repeater.Parent, RepeaterItem)
dim objecta as ObjectA = ctype(parentItem.DataItem, ObjectA)
return objecta.ObjectAId.ToString()
end function

or do something to increase the readability...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"TheBurgerMan" <Th**********@gmail.com> wrote in message
news:us**************@TK2MSFTNGP09.phx.gbl...
Thanks Karl. That is the missing piece I needed. I did not want to add a
lot of references in my base objects as they could be in different parent
objects. With your code I can access the data in the sub-repeater without
adding more to my objects.

Works great.
--
Thanks,
TheBurgerMan
at
gmail.com
--
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uU**************@TK2MSFTNGP10.phx.gbl...
Well, you could certainly walk up the control tree and get the parent
ItemTemplate's DataItem...ala:

<%# ((Object
A)((RepeaterItem)Container.Parent.Parent).DataItem ).ObjectAId%>
but that seems offly unreadable and easily breakable...why not put a
refernece to ObjectB's parant in ObjectB ?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"TheBurgerMan" <Th**********@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I forgot the DataSource for the ObjectB repeater, I have added it below.
--
Thanks,
Th**********@gmail.com
--
"TheBurgerMan" <Th**********@gmail.com> wrote in message
news:um*************@TK2MSFTNGP09.phx.gbl...
> Hi all. I have an array of objects (Let's call it Object A) and each
> of
> these objects has an array of other objects (Let's call these Object B)
in
> it. I can successfully repeat through Object A's and for each Object
A I
> can successfully repeat Object B's that are in it, like so:
>
> Object A-1
> Object B-1-A-1
> Object B-2-A-1
> Object B-3-A-1
> Object A-2
> Object B-1-A-2
> Object B-2-A-2
> Object A-3
> Object B-1-A-3
> Object B-2-A-3
> etc ...
>
> I am placing a button beside each Object B so the user can delete

that > Object if they chose. My problem is that I cannot identify (in code)
> which Object A the user wants to delete from? I am using the following > code:
>
> asp:Repeater ID="objectARepeater" Runat="server"
> <stuff>
> asp:Repeater ID="objectBRepeater" Runat="server" DataSource='<%#
> DataBinder.Eval(Container.DataItem,"ObjectBs") %>'>
> <stuff>
> a href="MyCode.aspx?mode=deleteObjectB&ObjectBId=<%#
> DataBinder.Eval(Container.DataItem, "ObjectBId")
> %>&ObjectAId='ObjectAId"><img align="absBottom" border="0" alt="Delete > ObjectB Item" src="images/delx.gif"></a
> /asp:Repeater
> /asp:Repeater
>
> I have ObjectBId in the ObjectB object, but I do not store ObjectAId in > the ObjectB object, this value is in ObjectA. I need this value so I

know
> which ObjectA to delete the ObjectB from.
>
> How do I reference the ObjectAId from the ObjectA while in the ObjectB > repeater?
>
> --
> Thanks,
> Th**********@gmail.com
> --
>
>



Nov 19 '05 #5

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

Similar topics

0
by: Ed Allan | last post by:
http://ejaconsulting.com/nestedrepeater/NestedRepeater.txt >-----Original Message----- >Doh! The HTML has all been rendered . . . > >Right click on this link and select 'Save target as ..' >to...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
8
by: I am Sam | last post by:
Hi everyone, This problem is making me old. I don't want to get any older. I have a multi-nested repeater control as follows: <asp:Repeater ID="clubRep1" Runat="server">...
2
by: mark | last post by:
(not sure if this is the correct group) My problem is I need to have a "nested" repeater. I have an array which I load into a hashtable - that part works great. I can setup the second repeater...
2
by: GD | last post by:
I'd like to use a Repeater to display data coming back from a cross-tab report. Because it's a cross-tab, I generally don't know how many columns are coming back. They do follow a certain format: ...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
4
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
0
by: uncensored | last post by:
Hello everyone, I'm fairly new at .Net and I have a repeater inside a repeater problem. I will attach my code to this message but basically what I am able to tell when I run my page it tells me...
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
3
by: Emma Middlebrook | last post by:
Hi there, I've been trying to implement a repeater control in an ASP.NET 2 page but I can't seem to get the layout exactly how I want and I'm not sure if it's something that I am doing wrong or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.