Replies
Hi Zdravko,
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;" />
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.