• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

Convert JSP TagLibrary refernce to work in ASP.NET Page

I am attempting to convert a JSP page into an ASPX and have a Java ForEach loop which references a java library.  How can I modify the code and reference to work in ASP.NET.

The TagLibary is;
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

Open in new window

The loop is;
<c:forEach items="${imageList}" var="loop">
<td><img alt="Image" src="App_Data/${loop}" onclick="setImage(this.title)" title="${loop}"></td>

Open in new window

the preceding javascript is;
function setImage(title){
		var sampltitle = title+',';
		document.getElementById("imagepassword").value =document.getElementById("imagepassword").value+sampltitle;

Open in new window

  • 2
1 Solution
The following generate a entire table
        <asp:GridView ID="Grid1" runat="server" AutoGenerateColumns="False" ShowHeader="false" >
            <asp:TemplateField HeaderText="Image">
                <asp:Image ID="Image1" runat="server" ImageUrl='<%# "App_Data/" + Eval("ImageURL")%>' ToolTip='<%# "" + Eval("ImageURL")%>' onclick="setImage(this.title)" />

Open in new window

Like this :
<table cellspacing="0" rules="all" border="1" id="Grid1" style="border-collapse:collapse;">
                <img id="Grid1_Image1_0" title="image1.jpg" onclientclick="setImage(this.title)" src="App_Data/image1.jpg">
                <img id="Grid1_Image1_1" title="image2.jpg" onclientclick="setImage(this.title)" src="App_Data/image2.jpg">
                <img id="Grid1_Image1_2" title="image3.jpg" onclientclick="setImage(this.title)" src="App_Data/image3.jpg">

Open in new window

With the following server side code (Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load) :
            Dim imageList As New DataTable()
            imageList.Columns.Add("ImageURL", Type.GetType("System.String"))

            Grid1.DataSource = imageList

Open in new window

XGISAuthor Commented:
Thankyou leakim971, I will test it now, as an alternate to the JS. Your code is always A1!
XGISAuthor Commented:
The code did not resolve the original issue but still provided a way forward.. thankyou leakim
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now