I have an updatepanel that has an Image button:
<asp:ImageButton ID="btnChangeMedium" OnClick="Change_Click" runat="server" />
When the page loads, based on some logic, I set the onclick attributes in the code behind.
btnChangeMedium.Attributes.Add("onclick", "ChangeMedium();");
Works greate in IE. In FF, the imagebutton causes a postback! By trial and error and by searching the web, I found the culprit to be the onclick. One blog entry suggested that if the OnClientClick is set, then the postback should not happen, so I changed the imagebutton to:
<asp:ImageButton ID="btnChangeMedium" OnClick="Change_Click" runat="server"
OnClientClick="#"/>
I was able to get it to not do a postback on the imagebutton click, but unfortunately, it did not solve my problem fully. The HTML rendered now is:
<input type="image" id="ctl00_WorkSpaceContent_ctlParent_btnChangeMedium"
src="../../images/sec.gif" onclick="#;ChangeMedium();"/>
So, the ChangeMedium()
function is never called. Any workarounds to this problem?
Any help is really appreciated
Thanks!