javascript - How to get the images src which are in template field of gridview -
<asp:templatefield headertext="picture" itemstyle-height = "150" itemstyle-width = "170"> <itemtemplate> <asp:image id="image1" runat="server" height="150" width="150" imageurl = '<%# eval("picturepath", geturl("{0}")) %>'/> </itemtemplate> <controlstyle height="150" width="150" /> <itemstyle height="150" width="150"></itemstyle> </asp:templatefield>
i know how images src using getelementbyid.but requirement image src gridview template field.i want display images src in grid list box.src should src="http://localhost:61027/images/jellyfish.jpg"
you should able underlaying data item in gridview rowdatabound event. if listbox id lbimagesource, example, here code you'll want:
if e.row.rowtype = datacontrolrowtype.datarow dim drv datarowview = ctype(e.row.dataitem, datarowview) lbimagesource.items.add(string.format("src=""{0}""", drv("picturepath").tostring())) end if
you'll want clear listbox @ point well. gridview databinding event should work that.
lbimagesource.items.clear()
Comments
Post a Comment