I use ASP.NET and jQuery and i use a Dialog. In this Dialog I have Webcontrols. If I click on a a Button in the Dialog then the Dialog close but I don't want that the dialog close if I search a User in this Dialogbox :(
Here a example for my Problem:
If I click on the lupe symbol I can open a Dialog for Searching a User in our Active Directory.
But If I click on the Searchbutton on the Dialog then it close first and if I open the dialog agein, I can see the Found users :/
The same Problem I have if I click on the Tab "Signatur" If I click there on a Button the the Page load new with the tab "Abwesenheit" but the Signatur is create if I click on the tab "signatur" agein :(
My Code: (jquery code for the dialog)
$(document).ready(function () {
$("#dialog").dialog({
autoOpen: false,
modal: true,
resizable: false,
height: 450,
width: 600,
closeOnEscape: false,
buttons: {
}
});
$("#dialog").parent().appendTo($("form:first"));
$("#DialogOpen").click(function () {
$("#dialog").dialog("open");
$("#dialog").parent().appendTo($("form:first"));
return false;
});
});
Here my ASPX:
<div id="dialog" title="Vertreterliste">
<asp:TextBox ID="txtBox" runat="server" ></asp:TextBox>
<asp:ImageButton ID="imageSearch" runat="server"
ImageUrl="~/Theme/Pictures/lupe.jpg" Height="24px" Width="25px"
onclick="imageSearch_Click" />
<hr />
<asp:ListView runat="server" ID="myListView" OnItemCommand="myListView_ItemCommand"
OnSelectedIndexChanging="myListView_SelectedIndexChanging">
....
</asp:ListView>
</div>
What can I do that the Dialog not colse if I click on a Webcontrol :/
Your dialog is closing because your web control doing post back, so, the complete page is being post to server, and when it is returning again it has not such information that dialog is opened or not.
So you can stop your dialog for being close on a webcontrol, by using UpdatePanels, or send request by ajax.
Or you can store dialog opening status in a hidden field, and when page loads back, check this hidden field value and according to value open your dialog again with client side script.