imagebutton event handler
-
i tried using response.redirect instead of server.trnasfer but i still culdn't get the result i want. instead the web form refreshes. Without displaying the image button again. How should i do when add an event handler to an image button if i code it programtically. thanx
-
i tried using response.redirect instead of server.trnasfer but i still culdn't get the result i want. instead the web form refreshes. Without displaying the image button again. How should i do when add an event handler to an image button if i code it programtically. thanx
Here is some old code I grabbed that used an image button with a redirect. ''// ASPX Page
<asp:imagebutton id="ibtnCheck" runat="server" ImageUrl="../images/OK2.gif" Visible="True"></asp:imagebutton> ''// Code Behind Page Protected WithEvents ibtnCheck As System.Web.UI.WebControls.ImageButton Public Sub ibtnCheck_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibtnCheck.Click HttpContext.Current.Response.Redirect("NewPage.aspx") End Sub
Note I said old code because using response.redirect is very bad on performance. Thus I have replaced the above code with the following: ''// ASPX Page<asp:hyperlink id="lbtnCheck" runat="server" ImageUrl=../images/OK2.gif></asp:hyperlink> ''// Code Behind Page Protected WithEvents lbtnCheck As System.Web.UI.WebControls.HyperLink lbtnCheck.NavigateUrl = "NewPage.aspx"
Hope this is helpful. Jason W.