Question

I have the following html:

<a href="javascript:<%# 'js code' %>" class="MyClass">
<div class="HeaderRow" style="vertical-align:middle;text-align:left;height:35px;width:998px;">
<b style="vertical-align:middle;"><%# ((MyObject)Container.DataItem).Name %></b>: <%# ((MyObject)Container.DataItem).ImageSrc%>
</div>
<p style="margin-left:10px;"><%# ((MyObject)Container.DataItem).Notes%></p>
</a>

It renders properly. However, when I try to click on the image provided by ((MyObject)Container.DataItem).ImageSrc, nothing happens. If I click anywhere else within the page, the links works fine. What's happening here?

Was it helpful?

Solution

Why don't you make your image or div clickable?

<div class="HeaderRow" 
     style="vertical-align:middle;text-align:left;height:35px;width:998px;" 
     onclick="<%# 'js code' %>">
    <p style="vertical-align:middle;">
        <strong><%# ((MyObject)Container.DataItem).Name %>:</strong>
        <%# ((MyObject)Container.DataItem).ImageSrc%>
    </p>
</div>
<p style="margin-left:10px;">
    <%# ((MyObject)Container.DataItem).Notes%>
</p>

Try to avoid non semantic elements (span, div, b, i, blink) when making your html.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top