Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7549097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:51:56+00:00 2026-05-30T09:51:56+00:00

I have a list of images that are pulled from a database and loaded

  • 0

I have a list of images that are pulled from a database and loaded into a ListView in ASP. I have a JQuery click function attached to each image that is generated. What I need to do is somehow get the id of the image that is clicked, but right now, I dont see a way to attach an ID to each image.

The ListView is populated from a SQLSource that has the columns ID, UserName, Photo. The item template uses username and photo to display the list, but will not let me set the ID using Eval(“fieldName”).

What I’m trying to do is: when the user clicks the image, the ID associated with that image is grabbed by JQuery, which opens up another window and uses that ID has part of a querystring. Ex:

window.open(“anotherpage.aspx?id=” + imgID);

Here is the jquery I have right now:

<script type="text/javascript">
        jQuery(document).ready(function () {

            $('[class=originalPhoto]').click(function (event) {
                var url = $(this).attr("href");
                var windowName = "popup";

                window.open("test.aspx");
                event.preventDefault();
            });
        });
 </script>

And the listview:

<telerik:RadListView ID="photoList" runat="server" 
                DataSourceID="employeePicsSource" DataKeyNames="ID">
                <ItemTemplate>
                    <center>
                    <p>
                    <table border="0" width="1000" cellpadding="10" class="personnelCell">                        
                        <tr>
                            <td width="25%"><%#Eval("FullName") %></td>
                            <td width="25%"><%#Eval("ADGUID") %></td>
                            <td width="25%" align="center"><asp:Image runat="server" 
                            ImageUrl='<%#GetImageURL((int)DataBinder.Eval(Container.DataItem,"ID")) %>' 
                            Width="200" CssClass="originalPhoto" /></td>
                            <td width="25%"><asp:Image runat="server" Width="96" Height="96" /></td>
                        </tr>
                    </table>
                    </p>
                    </center>
                </ItemTemplate>
            </telerik:RadListView>
            <asp:SqlDataSource ID="employeePicsSource" runat="server" 
                ConnectionString="<%$ ConnectionStrings:Employee_Photos_DevConnectionString %>" 

                SelectCommand="SELECT [FullName], [ADGUID], [Photo], [ID] FROM [Employee_AndPhoto]">
            </asp:SqlDataSource>

Any ideas? TIA

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:51:57+00:00Added an answer on May 30, 2026 at 9:51 am

    In the same way you get the href you can have the id as well

    $('.originalPhoto').click(function (event) {
        var url = $(this).attr("href");
        var id = $(this).attr("id");
        var windowName = "popup";
    
        window.open("test.aspx?id="+id);
        event.preventDefault();
    });
    

    As jostster says, you also need to add the id to you image, something like

    id='Convert.ToString((int)DataBinder.Eval(item.DataItem, "ID"))'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've coded myself into a CSS corner. I have a list of images that
I have a dynamic list of items pulled from a database, where the list
I have a list of images that i’ve loaded with the Loader class, but
I have a list of images that need to be displayed. However theres only
I have an unordered list of images that display inline and float next to
I have list of images. I want that user can see images by sliding
I have a list of 179 thumbnail images that I am trying to apply
I have a list of images and a delete button attached with each image.
In my gallery I have thumbnail images that sit in an unordered list. For
I have a list of images that float alongside each other and some links

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.