【发布时间】:2023-04-01 10:59:01
【问题描述】:
环境:VS2012、jquery和VB代码后面 这是一个简单的 imageButton
<td><asp:imageButton onClick="Function generated by vs" ..>
当客户端单击此按钮时,不会触发任何事件。 使用 listview 和 updatePanel 并触发 imageButton 的另一个代码仍然存在同样的问题。
此代码在我使用简单的 Html 页面时有效,但在我有母版页时无效?
<table id="tableImg" class="tableImage">
<tr>
<td>
<asp:ImageButton ID="PagerLeft" CssClass="divPagerLeft"
ImageUrl="~/Medias/Config/SliderMoveLeft.gif"
OnClick="PagerLeft_Click"
runat="server" />
</td>
<td class='tdImage'>
<asp:Image ID="img1" ClientIDMode="Static" CssClass="imgIntoGallery" ImageUrl="/" AlternateText="img1" runat="server" />
</td>
<td class='tdImage'>
<asp:Image ID="img2" ClientIDMode="Static" CssClass="imgIntoGallery" ImageUrl="/" AlternateText="img1" runat="server" />
</td>
<td class='tdImage'>
<asp:Image ID="img3" ClientIDMode="Static" CssClass="imgIntoGallery" ImageUrl="/" AlternateText="img1" runat="server" />
</td>
<td class='tdImage'>
<asp:Image ID="img4" ClientIDMode="Static" CssClass="imgIntoGallery" ImageUrl="/" AlternateText="img1" runat="server" />
</td>
<td class='tdImage'>
<asp:Image ID="img5" ClientIDMode="Static" CssClass="imgIntoGallery" ImageUrl="/" AlternateText="img1" runat="server" />
</td>
<td class='tdImage'>
<asp:Image ID="img6" ClientIDMode="Static" CssClass="imgIntoGallery" ImageUrl="/" AlternateText="img1" runat="server" />
</td>
<td>
<asp:ImageButton ID="PagerRight" ClientIDMode="Static" CssClass="divPagerRight"
ImageUrl="~/Medias/Config/SliderMoveRight.gif"
OnClick="PagerRight_Click"
runat="server" />
</td>
</tr>
</table>
CODE BEHIND :-
Protected Sub btnRight_Click(sender As Object, e As EventArgs)
ClientScript.RegisterStartupScript(Me.[GetType](), "alert", "alert('RightClick')", True)
Dim start_index As Integer = 0
If (ViewState("start_index") Is Nothing) Then
ViewState("start_index") = 0
Else
start_index = Convert.ToInt32(ViewState("start_index"))
End If
If (start_index < nbrRows - PageSize) Then
start_index += 1
ViewState("start_index") = start_index
idxFrom = start_index
idxTo = idxFrom + PageSize
getImgFromSql()
End If
End Sub
【问题讨论】:
标签: asp.net .net vb.net imagebutton