Hi There,Looking for your help please.
I have a webdialog that has a cancel button on it and I need it to act like the [x] in the top right hand corner. I.E. clicking it closes the webdialog window without causing a post back.
How would I do that?
Thanks for your help.
Best Regards,
Steve.
Hi Viktor
Thanks for your reply.
Your suggestion helped me.
Thanks
Swetha
Hi Swetha,
In order to permanently disable postback triggered by WebImageButton, you may use property of button AutoSubmit=false.
However, in your codes you have server handler (AssignTP) attached to button. I guess you need a conditional postback. In order to prevent postback dynamically, you may set "cancel" member of second parameter in Click event to true.
Below is example:
<script type="text/javascript"> function cmdYes_Click(oButton, oEvent) { var yes = window.confirm('Do you want submit?'); if (!yes) oEvent.cancel = true; }</script><igtxt:WebImageButton ID="cmdYes" Text="Yes" runat="server"> <ClientSideEvents Click="cmdYes_Click" /></igtxt:WebImageButton>
Hi Viktor,
I have a similar problem as above.I have yes and No infragistcs buttons in my dialog window.and I am doing some updates to the sql table on clicking on yes button.
when i click on yes button it is doing post back.how can i avoid this post back?
<
div style="position: absolute; right: 5px; top: 75px; height
: 23px">
Hi Steve,
I guess asp:ImageButton interprets the 'onclick' as server event. It is rather odd approach, because most asp controls allow to use exact names of javasctipt event handlers as attributes on level of control and controls have names of server events slightly different from conflicting javascript events.
I looked at properties of ImageButton and found "onclientclick". So, you may use it. Also instead of "onclick" you may use other javascript events like "onmousedown" or "onmouseup" or "ondblclick".
Also, I am not sure when ImageButton triggers full postbacks and how to suppress them. I guess you do not want those full postbacks. If yes, then I would recommend you to replace ImageButton by a plain
<img src="yourimage" onclick="closeDialog()" />
Below are examples with ImageButton:
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Images/htmleditor/bold.gif" onmousedown="closeDialog()" /> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/htmleditor/bold.gif" onclientclick="closeDialog()" />
Hi Victor,
That works nicely but how would I do it with an image button.
<asp:ImageButton ID="imgbCancel" runat="server" ImageUrl="~/Images/dark_blue_dlg_cancel.gif" onclick="closeDialog()" />Compiler Error Message: BC30456: 'closeDialog' is not a member of 'ASP.printbyparam_aspx'.
Steve Wilson.