LIN said:
hii this is working for only a single button when i have more than a single
button and write the same code below ..both the button's are getting
executed ....i.e i get the messages from both the buttons ...wht do i do
now ..
and one more thing the button im using here is an image button and not
a normal button
Given two ImageButton WebControls
<asp:ImageButton id="ImageButton1" runat="server" ImageUrl="image1.jpg" />
<asp:ImageButton id="ImageButton2" runat="server" ImageUrl="image2.jpg" />
The events handlers (and code to get each ID) looks like:
Private Sub ImageButton1_Click(ByVal sender As System.Object, _
ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Dim myImageButton As ImageButton = CType(sender, ImageButton)
Dim myImageButtonID As String = myImageButton.ID
End Sub
Private Sub ImageButton2_Click(ByVal sender As System.Object, _
ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click
Dim myImageButton As ImageButton = CType(sender, ImageButton)
Dim myImageButtonID As String = myImageButton.ID
End Sub
When you click on a single ImageButton, the corresponding click event handler fires,
not both. If you are seeing both click event handlers fire for a single click on one of
the ImageButton, then post some sample code which repros the problem.
--
Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com