Showing posts with label entry. Show all posts
Showing posts with label entry. Show all posts

Wednesday, March 21, 2012

Loading data from popup to parent window without refreshing the parent window.

Hi all,

I have a requirement to pass data from a popup window to the parent window. There is an order entry screeen. The user has to select a customer before entering the order. On clicking the search customer button, a popup will open up where the user can do the search. The user will select a customer and the selected customer details should be passed back to the parent window without refreshing the parent window.

How can this be accomplished? Kindly help me as this is a very urgent requirement.

hello.-

not really an ajax question. lots of examples out there that show this. here's one:

http://www.eggheadcafe.com/articles/20060117.asp


Hi Luis,

Thanks a lot. I will try to implement as mentioned there in the website. if I have any queries, I will get back to you.

Regards

Anup


Hi,

Do it like this:

mother.aspx:

<%@. Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Caller</title>

<script type="text/javascript">
function popup()
{
window.open("Popup.aspx", "children");
}
</script>

</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<div>
<input type="button" value="popup" onclick="popup()" />
<input type="button" value="Button" id="Button1" />
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<div style="display: none">
<asp:Button ID="Button2" runat="server" Text="Button" /></div>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>

children.aspx:

<%@. Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function callback()
{
window.opener.document.forms["form1"].elements["Button2"].click();
}
</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"OnClientClick="callback();" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

For more information,seecross window update the update panel

Best Regards,