Container.ItemIndex and repeater.Items.Count

1,831 views
Skip to first unread message

supercrossking

unread,
Apr 29, 2008, 7:11:39 PM4/29/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Ok. I can display the results on a web page and I can watch them count
to the last item in my example, which is 6. However,
Container.ItemIndex = alsoBoughtList2.Items.Count -1 do not equal, so
I never get to yes below. Why????

ItemCount: 6 | Container.ItemIndex: 6
It always displays no.

<%# iif(Container.ItemIndex = alsoBoughtList2.Items.Count -1, "yes",
"no")%>

However, if I do this.

<%# iif(Container.ItemIndex = 6, "yes", "no")%>

it works.

What is going on?

Glenn

unread,
Apr 30, 2008, 3:40:26 PM4/30/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Finding it hard to follow what you have. You are specifying two
different controls. Offhand, I would say that you're assuming that
Container and alsoBoughtList contain the same items at the same
locations. That may be an incorrect assumption.

More details..

...Glenn

supercrossking

unread,
Apr 30, 2008, 6:50:53 PM4/30/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
alsoBoughtList2 is a repeater control. The count for my example in the
repeater, alsoBoughtList2.Items.Count -1 is 6 too. What I am saying is
if I statically put in the number 6, it works. However, when I try to
use the repeater's count, it does not work.
> > What is going on?- Hide quoted text -
>
> - Show quoted text -

supercrossking

unread,
May 1, 2008, 11:49:06 AM5/1/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
If I add a static 6, like in the 2nd example, it works. The first does
not. I am using repeater item count.

<%# iif(Container.ItemIndex = alsoBoughtList2.Items.Count -1, "yes",
"no")%>



<%# iif(Container.ItemIndex = 6, "yes", "no")%>


On Apr 30, 3:40 pm, Glenn <ke4ktza...@gmail.com> wrote:

Cerebrus

unread,
May 1, 2008, 12:52:40 PM5/1/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Try debugging and checking the value of alsoBoughtList2.Items.

Glenn

unread,
May 1, 2008, 1:00:29 PM5/1/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
You still haven't provided us with the coorelation between Container
and alsoBoughtList2!

If (Count == 6) && (ItemIndex == 6) then ItemIndex != (Count - 1).
Are you sure you are doing the correct comparison?

As Cerebrus mentioned, run it through your debugger and make sure you
have the values you think you have. You're specifying two different
controls, make sure of what you have. Go back and review your
"Debugging 101" class.

...Glenn

Cerebrus

unread,
May 1, 2008, 1:05:27 PM5/1/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I think he was bunking class that day... :P

Glenn

unread,
May 1, 2008, 1:19:10 PM5/1/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Lesson to all the children out there: Stay in school and do NOT skip
class!!

...Glenn

Glenn

unread,
May 1, 2008, 1:24:08 PM5/1/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I'll give you a hint:

If "ItemIndex = Count - 1" doesn't work but "ItemIndex = 6" does work,
then the problem is with "Count - 1"!!

Think logically, NOT numerically.

...Glenn

On May 1, 11:49 am, supercrossking <supercrossk...@gmail.com> wrote:

supercrossking

unread,
May 1, 2008, 5:25:16 PM5/1/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I can see the values on the page I am displaying them on. I believe
the problem is because the Container.ItemIndex is only available
during data binding. I was looking for help, not remarks...

coorelation between Container.ItemIndex (repeater data items) and
alsoBoughtList2<----(repeater)

<%# iif(Container.ItemIndex = alsoBoughtList2.Items.Count -1, "yes",
"no")%>

<%# iif(Container.ItemIndex = 6, "yes", "no")%>

> > <%# iif(Container.ItemIndex = 6, "yes", "no")%>- Hide quoted text -

Glenn

unread,
May 2, 2008, 1:54:22 PM5/2/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I am giving you help, you're just not following it. You keep coming
back with the same lines every time. You have the complete code and
development environment in front of you, we don't. You need to tell
us what is going on. All we can do is direct you to places to look.
It's up to you to figure it out!

Go back to "Debugging 101" and work things through. Either your
interactive debugger or outputing of the values will work.

We're not psychic. Phychotic, maybe, but not phychic.

...Glenn

Cerebrus

unread,
May 4, 2008, 1:45:39 AM5/4/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I agree. We can only give the OP suggestions... finding the solution
remains upto the OP.

Glenn Niesen

unread,
May 4, 2008, 8:48:19 AM5/4/08
to DotNetDe...@googlegroups.com
Just to make sure I'm not completely crazy (DON'T COMMENT!!)
 
If "ItemIndex = Count - 1" doesn't work, but "ItemIndex = 6" does work, then that would mean "Count - 1 <> 6".  Right?  I think it is really obvious where the problem is.
 
...Glenn

--
Glenn Niesen
http://www.onefryshort.org
Reply all
Reply to author
Forward
0 new messages