Hi TS,
Sorry for my delay. From your description, I know that you would like to
stop the post back of the imageButton, but although you added 'return
false' in the onclientclick event handler, a 'WebForm_DoPostBackWithOptions
function' is also added into the rendered control and the imageButton still
make post back. If I misunderstood you, please tell me.
The cause of the 'extra' code -- WebForm_DoPostBackWithOptions-is the
imageButton has been added a property 'PostBackURL'. If we set this
property of some button, when we click this button, the page would be post
back to the URL which you set as the value. Such function
'WebForm_DoPostBackWithOptions' is to DoPostBack with the options: the
button's ID and the URL value.
Please remove the setting of the PostBackUrl property to avoid the 'extra'
code.
You said that you added 'return false' inside the client function. However,
in the rendered control, the WebForm_DoPostBackWithOptions function can
still be fired. To avoid this, we can add the 'return false' after the
client function like this:
<asp:ImageButton ID="ImageButton1" runat="server"
Imageurl="~/click.gif" OnClientClick="clientClick();return false;"
PostBackUrl="~/Default.aspx" />
The related document:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.pos
tbackurl.aspx
--
Sincerely,
Zhi-Qiang Ni
Microsoft Online Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================