使用JQuery加载图像后,ImageURL返回空

时间:2016-02-17 21:27:53

标签: jquery

我的页面上有一个带有ImageButtons的DataList。我正在使用JQuery在ImageButtons中加载图像。它工作正常。但是当我尝试循环访问DataList以获取ImageButtons的ImageURL时,我什么都没得到。

我是否需要使用任何其他方法来获取图像的URL?我使用以下JQuery加载图像:

img.attr("src", photo.find("URL").text());

我想我没有提供足够详细的问题。我正在研究ASP.NET和VB。

我的webform上有一个DataList,它有ImageButtons。我正在使用JQuery(上面的代码行)在这些ImageButtons中加载图像。我想在用户点击ImageButton时从我的VB代码中获取ImageURL。但我得到的只是一个空字符串。

ImageButton的HTML是:

<asp:ImageButton runat="server" ImageUrl='<%#Eval("Url")%>' CssClass="image" OnClick="img_Click" />

后面的代码中的img_Click函数:

Protected Sub img_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim img As ImageButton = TryCast(sender, ImageButton)
    Dim str As String = img.ImageUrl
End Sub

0 个答案:

没有答案
相关问题