I have two page one is parent and child. Parent page has text field and command button. The Link button open a child page as a popup. Child page as Text box and Button. when i click the button it will transfer child textbox data parent page text box. this is working fine when i use normal page(Not using master page on it). Parent page aspx: -
-
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox>
-
<a href="#" onclick="OpenNewWindow()">Lookup</a>
-
-
-
function OpenNewWindow()
-
{
-
window.open('Child.aspx','MyPopUp','width=500,height=700,scrollbars=1,resizable=1');
-
}
-
Child.aspx: -
-
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
-
<input id="Button2" onclick="Transfer()" type="button" value="Select" style="width: 65px" />
-
-
function Transfer()
-
{
-
window.opener.form1.TextBox1.value = document.getElementById("TextBox1").value;
-
window.close();
-
}
-
This code is working fine. Child page transfer the data parent.
But i when i use master page in parent page. I can open child page using pop up. The child page not transfering the data to parent page with same code. i dont know whats went wrong. Can i anybody what i have to change. I am not getting any error and the data is not transfering
Thanks in advance
21 3916
Hi imtmub,
If you check the source html generated by your code you'll probably find that the ID of TextBox1 has been changed to something like ctl00_Content1_TextBox1.
To get the actual ID you need to pass the ClientID property of your TextBox control to your popup window and use that to pass the value back. Here's an example: Parent: - window.open('Child.aspx?txt=<%=TextBox1.ClientID%>','MyPopUp','width=500,height=700,scrollbars=1,resizable=1');
Child: - window.opener.form1.TextBox1.value = document.getElementById('" & Request.Querystring("txt") & "').value;
Let me know how you get on,
Dr B
PS You posted this in the ASP Forum which is for Classic ASP only - I've moved it for you but please remember to post all future ASP.NET questions in the .NET Forum. Thanks.
Dr B
First of all I have to say thanks for ur response.
When i check the Source html genreted by my code My Textbox1 id change to "ctl00_ContentPlaceHolder1_TextBox1"
Then I have modified my java function according to your suggestion. Still i am facing the same problem. The Textbox is not transfering data to parent page textbox. Can u see anyother info i need to change?
Thanks
Can you show me the code you're using now on each page please?
Thanks,
Dr B
Can you show me the code you're using now on each page please?
Thanks,
Dr B
Parent Page: -
-
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox>
-
<a href="#" onclick="OpenNewWindow()">Lookup</a>
-
function OpenNewWindow()
-
{
-
-
window.open('ChildMain.aspx?txt=<%=TextBox1.ClientID%>','MyPopUp','width=500,height=700,scrollbars=1,resizable=1');
-
}
-
ChildMain: -
-
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
-
<input id="Button2" onclick="Transfer()" type="button" value="Select" style="width: 65px" />
-
-
function Transfer()
-
{
-
window.opener.form1.TextBox1.value = document.getElementById('" & Request.Querystring("txt") & "').value;
-
window.close();
-
}
-
Thanks
I can't see anything obvious - can you check the value that is passed in the querystring and compare it the actual ID from your mark-up. Are they the same?
I can't see anything obvious - can you check the value that is passed in the querystring and compare it the actual ID from your mark-up. Are they the same?
I have checked. I m going to leave this wndow.opener.
Do you any other method that i can post back value
I have checked. I m going to leave this wndow.opener.
Do you any other method that i can post back value
I dont know where i m doing wrong. if ou have any demo page that will be great help
I dont know where i m doing wrong. if ou have any demo page that will be great help
Please i wana complete this form with in this week. please help me to transfer data from child page text box to parent page text box.
I have tried java funstion is not working out for me. If you any vb script or demo page that will be great help.
Please i wana complete this form with in this week. please help me to transfer data from child page text box to parent page text box.
I have tried java funstion is not working out for me. If you any vb script or demo page that will be great help.
I m waiting answer. Please help me out
Please do not use form1 in Transfer method
this may helps you
document.opener.document.getElementById("Text1").v alue = document.getElementById("text1").value;
modify ur code and let me know updates
Please do not use form1 in Transfer method
this may helps you
document.opener.document.getElementById("Text1").v alue = document.getElementById("text1").value;
modify ur code and let me know updates
I have modified as per ur suggestion. But still its same
I have modified as per ur suggestion. But still its same
I'm not the greatest with JavaScript but I'm almost 100% sure that you cannot transfer data between a child and parent browser.
You will have to try and use the server to transfer the data.
The problem is that after your child window is finished, the parent one will have no idea that this has happened and the server has no way to indicate to the parent browser that there is updated data waiting for it.
I would suggest placing the content of your child window inside a <div> that can be positioned to display as if it were floating in front of the parent data. Remember that asp Panels are rendered as <div>'s. That way your "parent" will have access to the data in the "child"...the only difference is that you aren't using 2 browsers.
-Frinny
I'm not the greatest with JavaScript but I'm almost 100% sure that you cannot transfer data between a child and parent browser.
You will have to try and use the server to transfer the data.
The problem is that after your child window is finished, the parent one will have no idea that this has happened and the server has no way to indicate to the parent browser that there is updated data waiting for it.
I would suggest placing the content of your child window inside a <div> that can be positioned to display as if it were floating in front of the parent data. Remember that asp Panels are rendered as <div>'s. That way your "parent" will have access to the data in the "child"...the only difference is that you aren't using 2 browsers.
-Frinny
I have place my function inside <div></div> but still its acting same. I m not getting what i want.
can u check -
-
document.opener.document.getElementById("Text1").value = document.getElementById("text1").value;
-
-
alert("Val 1 : " + document.getElementById("text1").value);
-
alert("Val 2 : " + document.opener.document.getElementById("Text1").value);
-
I have place my function inside <div></div> but still its acting same. I m not getting what i want.
Are you using AJAX?
Do you have your "child" object within one UpdatePanel and your parent in another? If this is the case, then your parent will be refreshed with old data.....
-Frinny
I'm not the greatest with JavaScript but I'm almost 100% sure that you cannot transfer data between a child and parent browser.
If that's the case then how come this: - document.opener.document.getElementById("TextBox1").value = 'Hello World!'; window.close();
-
works as a method of passing data back from child window to parent? I've used this method successfully to pass data back from calendar pop-ups and the like many times and I can't see how, with this being client-side JS, it could be passing it through the server rather than the browser.
I could, of course, be completely wrong and I would be interested if anybody knew how this worked.
Dr B
Are you using AJAX?
Do you have your "child" object within one UpdatePanel and your parent in another? If this is the case, then your parent will be refreshed with old data.....
-Frinny
My website is not AJAX enabled. I m not using AJAX. So i dont have update panel on my pages.
imtmub,
Have you managed to get this sorted yet?
Dr B
imtmub,
Have you managed to get this sorted yet?
Dr B
If not, could you please post any code that is relevant to this problem so that we can figure out what is wrong.
-Frinny
imtmub,
Have you managed to get this sorted yet?
Dr B
Yes.Finally decided not to use Master page. Instead of master page i have created user controls then placed on my pages. Anyhave i m really appriciating all of you people for the answers.
If not, could you please post any code that is relevant to this problem so that we can figure out what is wrong.
-Frinny
Hello Frinavale,
I have solved using user controls instead of master page.
Anyhave lets have a try if u can solve the master page issue. Here my parent Page(SingleLevelN.aspx). This page is master page enabled. -
-
%@ Page Language="VB" MasterPageFile="~/aspx/MasterPage.master" AutoEventWireup="false" CodeFile="SingleLevelN.aspx.vb" Inherits="aspx_SingleLevelN" title="Report-SingleLevelBOM" %>
-
-
<%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
-
Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
-
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
-
SelectParentId<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><a href="#"
-
onclick="OpenNewWindow()">Lookup</a>
-
<asp:Button ID="Button1" runat="server" Text="Button" /><br />
-
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true"
-
EnableParameterPrompt="False" ReportSourceID="CrystalReportSource1" />
-
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
-
<Report FileName="BOM1.rpt">
-
<Parameters>
-
<CR:ControlParameter ControlID="TextBox1" ConvertEmptyStringToNull="False" DefaultValue=""
-
Name="ParentId" PropertyName="Text" ReportName="" />
-
</Parameters>
-
</Report>
-
</CR:CrystalReportSource>
-
<script language="javascript" type="text/javascript">
-
-
function OpenNewWindow()
-
{
-
window.open('ChildMain.aspx','MyPopUp','width=500,height=700,scrollbars=1,resizable=1');
-
}
-
-
</script>
-
-
</asp:Content>
-
Child Page(Childmain.aspx). -
-
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ChildMain.aspx.vb" Inherits="aspx_ChildMain" %>
-
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-
<html xmlns="http://www.w3.org/1999/xhtml" >
-
<head runat="server">
-
<title>Untitled Page</title>
-
<script type="text/javascript">
-
function Transfer()
-
{
-
//window.opener.form1.TextBox1.value = document.getElementById('" & Request.Querystring("txt") & "').value;
-
window.opener.document.forms[0].Textbox1.value = document.getElementById("Textbox1").value;
-
-
window.close();
-
}
-
</script>
-
</head>
-
<body>
-
<form id="form1" runat="server">
-
<div>
-
Select Query Type
-
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
-
Width="173px">
-
<asp:ListItem Selected="True" Value="ItemId">ItemId</asp:ListItem>
-
<asp:ListItem>ItemName</asp:ListItem>
-
</asp:RadioButtonList>Enter the Item
-
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
-
<asp:Button ID="Button1" runat="server" Text="Find" Width="68px" />
-
<input id="Button2" onclick="Transfer()" type="button" value="Select" style="width: 65px" /><br />
-
<span style="font-size: 9pt">
-
Example(11001% or 316%8)<asp:GridView ID="GridView1"
-
runat="server" AutoGenerateColumns="False" DataKeyNames="ItemID" DataSourceID="SqlDataSource1"
-
Font-Names="Times New Roman" Font-Size="11pt" Width="463px">
-
<Columns>
-
<asp:CommandField ShowSelectButton="True">
-
<ItemStyle Width="85px" />
-
<ControlStyle Font-Size="Medium" />
-
</asp:CommandField>
-
<asp:BoundField DataField="ItemID" HeaderText="ItemID" ReadOnly="True" SortExpression="ItemID">
-
<ItemStyle Width="85px" />
-
</asp:BoundField>
-
<asp:BoundField DataField="ItemName" HeaderText="ItemName" SortExpression="ItemName" />
-
</Columns>
-
</asp:GridView>
-
</span><br />
-
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IERP52ConnectionString3 %>"
-
SelectCommand="If @QryType='ItemId' Begin Select top 1000 ima_itemid as ItemID, ima_itemName as ItemName from ima where (ima_itemid LIKE @IMA_ItemID) end Else Begin Select top 1000 ima_itemid as ItemID, ima_itemName as ItemName from ima where (ima_itemname LIKE @IMA_ItemID) end ">
-
<SelectParameters>
-
<asp:ControlParameter ControlID="RadioButtonList1" Name="QryType" PropertyName="SelectedValue" />
-
<asp:ControlParameter ControlID="TextBox1" Name="IMA_ItemID" PropertyName="Text" />
-
</SelectParameters>
-
</asp:SqlDataSource>
-
-
</div>
-
</form>
-
</body>
-
</html>
-
-------------------------------------
I have tried all the solution given in this forum. Finally i m ended with this code. But all the code results are same. not giving any result.
Anyhave thanks for showing interest to solve. It will be great help.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tom |
last post by:
Hi
I am trying to transfer to a different .ASPX page using Server.Transfer.
However, I get the following error:
"Error executing child request for .aspx."
Anyone know why?
Thanks for...
|
by: Julien C. |
last post by:
Hi all,
I have an "EditeItem.aspx" page which lets me edit properties of an "Item".
In the OnClick() event of my Save button, I do save Item changes to the
database and then I redirect the user...
|
by: Amar |
last post by:
After using Server.Transfer to transfer data from one page
to another, I would like to know if there is a way to keep
the receiving web page variables intact after a postback.
Here is the code...
|
by: Mr Wizard |
last post by:
I am going through the front controller http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/ImpFrontControllerInASP.asp and all works well except when the server.transfer...
|
by: Terry Mulvany |
last post by:
Grettings,
Normally I can use Request.RawUrl to get the 'current' page (amongst many
other things). But in the case of using a Server.Transfer
but the path from the root of
the site . So if...
|
by: David Berman |
last post by:
It seems that my site is losing session information when using
Server.Transfer. I have a page called PictureGallery.aspx. It takes an
argument which is an index id, so it would look like...
|
by: dee |
last post by:
Inside Search.aspx I make the following call:
Server.Transfers("Table.aspx");
I'm transfered to Table.aspx and browser still shows Search.aspx in address
bar. However, I do postback within...
|
by: bryan |
last post by:
I've got a custom HttpHandler to process all requests for a given
extension. It gets invoked OK, but if I try to do a Server.Transfer I
get an HttpException. A Response.Redirect works, but I really...
|
by: evantay |
last post by:
I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties
from my master pages within a page that inherits from that master page (a
child page). However the values are always null....
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |