Hi,
I have a image button which displays infragistics webdialog and the dialog needs to post back up on clicking 'Ok'(ok button inside the dialog). This works fine. The dialog page also has cancel button which hides dialog page when clicked. This too is working fine. Ok and cancel has onclick events which work fine(window state is hidden). But only problem occuring is when I try to close window (hit x on top right corner of webdialog) is that it is posting back. If I use link button instead of image button, this works fine (even though link button also opens webdialog and posts back when ok is clicked inside the web dialog and hides dialog when cancel clicked). I tried all the options but could not supress post back on closing web dialog. I used below but nothing works. Please help me.
return false at the end of function , onmouseover="this.style.cursor = 'pointer';"
onclientclick instead of onclick,
type="button" instead of type="submit" (default)
autopostback="false"
CausesValidation = False
Hello Deepu,
Thank you for contacting us.
As I understand you want to trigger a postback when the 'x' button of the dialog is clicked. By design we do not provide a functionality that can handle this click, although my suggestion is to use jQuery in order to catch the click of the html element and then use doPostBack in order to create a postback to the server. I have created sample for you in order to show you this approach.
Code snippet:
You can have a look at the article below regarding __doPostBack function:
http://www.codeproject.com/Articles/667531/doPostBack-function
Could you please let me know if I am missing something from your scenario. Looking forward to hearing from you.
Hi Zdravko,
Thank you for the reply. Its the other way around. I don't want post back when 'x' button is clicked. But for some reason it is posting back. The link to web dialog is through image button. Link button instead of image button works fine and as expected for web dialog.
I think that I am missing something from your scenario, because in the sample that I've send you, If you comment the "document ready" and if you hit 'x' button of the dialog. postback wont be made. Could you please comment it and let me know what are the results.
Looking forward to hearing from you.
I have this image button which is asp.net image button but not infragistics image button. I solved this through work around. I was not letting code execute in code behind when the return value is 'Close(when I hit, I set return value to 'Close'). I have another problem which is different than this.Below is the description.
I have a asp image button as below. The button when clicked navigates to aspx page which again contains ascx that has the required details (so its kind of nested). There is a seperate external js file that handle ShowDialog function (please see below) to display the infragistic web dialog. There is an hidden control on main page to hold the return values of ascx file. So when 'save' button in ascx file is hit, the values selected in ascx file are passed to main page through hidden control. This is working fine and values are returned (txtfirstname has the returned value,please see below). But unfortunately after the values are returned and return false statement is executed, the page refreshes and reset the txtfirstname value within span of fraction of seconds. I dont know why the btnAdd is posting back. I dont need a post back (showDialog false input parameter handle this. If this value is set to true postback is done through btnAdd.trigger(click). As this value is set to false, no post back is done.). To see whats happening I checked in browser and webform_postback option is added without my knowledge(please see browser section below). I dont know why asp image button is converted and extra post back is added even though I dint add anything. If I replace asp image button with link button, this post back is not added and works fine.
<aspImageButton id="btnAdd" runat="server" autopostback="false" CauseValidation="False" type="button" ImageUrl="~\Images\btnAdd.gif" OnClientClick="fnShowdialog();return false;" onmouseover="this.style.cursor = 'pointer';" > </aspImageButton>
<ig:WebDialogWindow runat="server" ID="igWebDialog" InitialLocation="Centered" UseBodyAsParent="true" Height="195px" Width="450px" Modal="True" WindowState="Hidden" Style="line-height: normal" ClientEvents-WindowStateChanged="WebDialogStateChanged" EnableViewState="False"> <RoundedCorners HeaderContentCssClass="myHeaderCorners" HeaderCornerLeftCssClass="myHeaderCorners" HeaderCornerRightCssClass="myHeaderCorners" /> <Header CssClass="myHeader" CaptionAlignment="Left" ></Header> <ContentPane BackColor="White"> </ContentPane> </ig:WebDialogWindow>
function fnShowdialog() { var URL = 'Default.aspx'; var retval = ''; ShowDialog($find('<%= igWebDialog.ClientID %>'), "Title", "515", "230", URL, $("#btnAdd"), 'click', false);
if ($("#hidRetValue").val() != '' && $("#hidRetValue").val() != null && $("#hidRetValue").val() != 'Cancel') { retval = $("#hidRetValue").val();txtFirstname.text=retval;
Hide(); $("#hidRetValue").val('');
return false; } else { return false; }
}
Browser section:
<input type="image" name="btnAdd" id="btnAdd" autopostback="false" CauseValidation="False" type="button" onmouseover="this.style.cursor = 'pointer';" src="../Images/btnAdd.gif" onclick="fnShowDialog();return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnAdd", "", true, "", "", false, false))" style="border-width:0px;" />
Thank you for the detailed explanation.
Unfortunately we do not support web image button and the others ASP controls, we only support our NetAdvantage controls. My suggestion is to use the link button instead.
Thank you Zdravko.
I thank you Deepu Y, for using our controls and for contacting us.