473,385 Members | 1,736 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,385 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 11513
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.