0
我收到以下錯誤代碼。 我正在使用中繼器顯示圖像。圖像ID是IMG。在jquery我使用$("#<%=img.ClientID %>")
獲取圖像。但是它給出的錯誤如img在當前上下文中不存在。中繼器ID是rptRepeater
。 我該如何解決這個問題? $("#<%=img.ClientID %>") doesnot exists in current context
圖像ID在當前上下文中不存在asp.net
.NET代碼
<asp:Repeater ID="RepeaterView" runat="server">
<ItemTemplate>
<a onmouseout="SelectEnd()" onmouseover='<%#Eval("Coords","preview(\"{0}\");")%>'>
<asp:Image ID="ImageZoom" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImageUrl") %> ' Height="150" Width="150" >
</asp:Image>
</a>
</ItemTemplate>
</asp:Repeater>
JavaScript代碼
<script type="text/javascript">
function preview(Coords) {
var arrResult = Coords.split(",");
var nx1 = arrResult[0];
var ny1 = arrResult[1];
var nx2 = arrResult[2];
var ny2 = arrResult[3];
var ias = $("#<%=ImageZoom.ClientID %>").imgAreaSelect({ instance: true });
ias.setSelection(nx1, ny1, nx2, ny2, true); ias.setOptions({ show: true });
ias.update();
}
</script>
我認爲你缺少一半的職位。 – epascarello
的 \t \t \t \t \t ItemTemplate中> ASP:直放站> –
你爲什麼要添加它作爲一個評論,而不是在代碼? – epascarello