Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Asp:imagebutton function not getting call on server side.

<asp:ImageButton ID="img" alt="" OnClick="Hello" runat="server" CommandArgument='<%# Eval("ImageUrl") %>' src='<%# Eval("ImageUrl") %>' />

VB
Protected Sub Hello(ByVal sender As Object, ByVal e As ImageClickEventArgs)
       ScriptManager.RegisterClientScriptBlock(Page, Me.GetType(), "Javascript", "alert('hello');", True)
       showAndHIde.Visible = "true"
   End Sub

on imageclick hello function not run.

Thanks
Shubham Gupta
Posted
Comments
F-ES Sitecore 3-Sep-15 6:31am    
The code is fine (apart from showAndHIde.Visible = True) so there must be something to do with the context of your code you're not telling us.
Member 11449483 3-Sep-15 6:46am    
this is a panel i am using this panel for show and hide some text.
but point is this debugger is not stop this function when click on image.
Thanks
hypermellow 3-Sep-15 11:28am    
I think @F-ES Sitecore is asking you to click the "Improve Question" button, and add relevant details to your question.

You could add a bit of detail about the data bound control (Repeater/GridView/ListView etc) that contains your ImageButton?

1 solution

I had the similar issue some time back. I just set the ImageButton's CausesValidation property to false and it worked fine.

Hope it would help you too!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900