472,992 Members | 3,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Repeater and Index Value

Hi,

I use a repeater that displays images.
I need to add dynamically a jscript function on each image that use the
index value of the repeater

<asp:Repeater ID="ph" runat="server" DataSourceID="myDataSource">
<ItemTemplate>
<asp:HyperLink runat="server" ID="link"
NavigateUrl="javascript:Slides(INDEXREPEATER)">
<asp:Image runat="server" ID="img" ImageUrl='<%#
Eval("myPic") %>' />
</ItemTemplate>
</asp:Repeater>

How to replace the INDEXREPEATER by the current index ?

Thanks in advance

Stan
Jan 22 '07 #1
5 11483
Stan SR wrote:
Hi,

I use a repeater that displays images.
I need to add dynamically a jscript function on each image that use
the index value of the repeater

<asp:Repeater ID="ph" runat="server" DataSourceID="myDataSource">
<ItemTemplate>
<asp:HyperLink runat="server" ID="link"
NavigateUrl="javascript:Slides(INDEXREPEATER)">
<asp:Image runat="server" ID="img" ImageUrl='<%#
Eval("myPic") %>' />
</ItemTemplate>
</asp:Repeater>

How to replace the INDEXREPEATER by the current index ?
<%# DataBinder.ItemIndex %>

--

Riki
Jan 22 '07 #2
Stan SR wrote:
Hi,

I use a repeater that displays images.
I need to add dynamically a jscript function on each image that use
the index value of the repeater

<asp:Repeater ID="ph" runat="server" DataSourceID="myDataSource">
<ItemTemplate>
<asp:HyperLink runat="server" ID="link"
NavigateUrl="javascript:Slides(INDEXREPEATER)">
<asp:Image runat="server" ID="img" ImageUrl='<%#
Eval("myPic") %>' />
</ItemTemplate>
</asp:Repeater>

How to replace the INDEXREPEATER by the current index ?
<%#Container.ItemIndex %>

--

Riki
Jan 22 '07 #3
Thanks Riki, but it seems it doesn't work. I get an error
Stan
"Riki" <ri**@dontnagme.coma écrit dans le message de news:
e7**************@TK2MSFTNGP03.phx.gbl...
Stan SR wrote:
>Hi,

I use a repeater that displays images.
I need to add dynamically a jscript function on each image that use
the index value of the repeater

<asp:Repeater ID="ph" runat="server" DataSourceID="myDataSource">
<ItemTemplate>
<asp:HyperLink runat="server" ID="link"
NavigateUrl="javascript:Slides(INDEXREPEATER)">
<asp:Image runat="server" ID="img" ImageUrl='<%#
Eval("myPic") %>' />
</ItemTemplate>
</asp:Repeater>

How to replace the INDEXREPEATER by the current index ?

<%# DataBinder.ItemIndex %>

--

Riki

Jan 22 '07 #4
Great.. it works..
I thank you
but now, I have a little problem :(
When I use
<asp:HyperLink id="link" runat="server"
NavigateUrl='javascript:Slides(<%=Container.ItemIn dex%>);' >bla
bla</asp:Hyperlinkit doesn't eval the Container.ItemIndex

So when I look at my source, I get
<a href="javascript:Slides(<%=Container.ItemIndex%>); ">bla bla</a>
Any idea ??

Stan
"Riki" <ri**@dontnagme.coma écrit dans le message de news:
ui**************@TK2MSFTNGP05.phx.gbl...
Stan SR wrote:
>Hi,

I use a repeater that displays images.
I need to add dynamically a jscript function on each image that use
the index value of the repeater

<asp:Repeater ID="ph" runat="server" DataSourceID="myDataSource">
<ItemTemplate>
<asp:HyperLink runat="server" ID="link"
NavigateUrl="javascript:Slides(INDEXREPEATER)">
<asp:Image runat="server" ID="img" ImageUrl='<%#
Eval("myPic") %>' />
</ItemTemplate>
</asp:Repeater>

How to replace the INDEXREPEATER by the current index ?

<%#Container.ItemIndex %>

--

Riki

Jan 22 '07 #5
Stan SR wrote:
Great.. it works..
I thank you
but now, I have a little problem :(
When I use
<asp:HyperLink id="link" runat="server"
NavigateUrl='javascript:Slides(<%=Container.ItemIn dex%>);' >bla
bla</asp:Hyperlinkit doesn't eval the Container.ItemIndex

So when I look at my source, I get
<a href="javascript:Slides(<%=Container.ItemIndex%>); ">bla bla</a>
Any idea ??

Stan
Try:

<asp:HyperLink id="link" runat="server"
NavigateUrl='<%# "javascript:Slides(" + Container.ItemIndex + ");" %>' >bla
bla</asp:Hyperlink>

--

Riki
"Riki" <ri**@dontnagme.coma écrit dans le message de news:
ui**************@TK2MSFTNGP05.phx.gbl...
>Stan SR wrote:
>>Hi,

I use a repeater that displays images.
I need to add dynamically a jscript function on each image that use
the index value of the repeater

<asp:Repeater ID="ph" runat="server" DataSourceID="myDataSource">
<ItemTemplate>
<asp:HyperLink runat="server" ID="link"
NavigateUrl="javascript:Slides(INDEXREPEATER)" >
<asp:Image runat="server" ID="img" ImageUrl='<%#
Eval("myPic") %>' />
</ItemTemplate>
</asp:Repeater>

How to replace the INDEXREPEATER by the current index ?

<%#Container.ItemIndex %>

--

Riki

Jan 22 '07 #6

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

Similar topics

6
by: michael | last post by:
Below is a simplified version of table cell mouseover script, running separate from the HTML code, that was posted on this group yesterday: var d=document, td; function mover(){...
2
by: Adam | last post by:
In my MYISAM table I have an index (Index_A) on 2 fields (Field_A, Field_B). There are millions of rows in the table. The cardinality of Index_A is 53. I think a query to count the number of rows...
1
by: savvy | last post by:
I'm writing a Search Query in Index Server SQL language. but not able to get the index value of any document in the Index Server. As this code strQuery = "Select Filename,PATH from Scope() where...
1
by: Priya | last post by:
Hi, I'm using a repeater control. I'm binding data to repeater dynamically. I need to modify the value of a label at runtime. I modified the text in the ItemDataBound event. But while displaying...
2
by: Dot Net Work | last post by:
I have a user control that contains a textbox and a link button. This UC sits inside a repeater control. When I click any button, any edited textbox value does not get sent back to the server...
1
by: DavidB | last post by:
I want to be able to find the value of the Caption property of a Page in my Tab Control based solely on the Page Index property value. Is this possible? Example... tcBedrock pFred - Page...
0
by: tedpottel | last post by:
Hi I am trying to right a script to keep a local copy of my mysql database in a local access file. I was able to do this in Access visual basic, but cannot get it to work in python. The...
3
by: Robert Bevington | last post by:
Hi all, I ran into memory problems while tying to search and replace a very large text file. To solve this I break the file up into chunks and run the search and replace on each chunk. This...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.