Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing Parameter Values to PopUp Window

    Dear All,

    I am struggle resolving this Issue

    I have a Parent.aspx and popup.aspx pages. I want to pass parameters from parent.aspx page and show it in popup.aspx page. It is working. I am displaying value in label of popup.aspx page now I want that label value on button click close popup page and paste label value in textbox of parent.aspx page

    how can do that

    My parent.aspx page is


    <asp:TextBox ID="txthospno" runat="server" AutoPostBack="True" Enabled="False" Width="95px"></asp:TextBox>
    <asp:TextBox ID="txtadmdate" runat="server" BackColor="Transparent" BorderColor="Black"
    BorderWidth="1px" Enabled="False" Width="64px"></asp:TextBox>
    <asp:Button ID="cmdimportlab" runat="server" Font-Bold="True" Font-Names="Calibri" OnClientClick="OpenPopup()"
    Font-Size="Medium" Height="38px" Text="IMPORT BIOCHEMISTRY LAB" Width="355px" /></td>

    and my script is

    <script language="javascript" type="text/javascript">
    function OpenPopup() {
    var hosp=window.opener.document.getElementById("txthospno").value;
    var admdate=window.opener.document.getElementById("txtadmdate").value;

    var hosp1 = Right(txthospno.Text, 7)

    var admdate1 = Mid(txtadmdate.Text, 3, 2) + "/" + Left(txtadmdate.Text, 2) + "/20" + Right(txtadmdate.Text, 2)

    popup("Default2.aspx?hp='" + hosp1 + "& adate='" + admdate1 + "'");
    // document.getElementById('TextBox2').focus();
    }

    // copied from Code To Open popup window in Center Position - DotNetFunda.com
    function popup(url) {

    var width = 300;
    var height = 200;
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    var params = 'width=' + width + ', height=' + height;
    params += ', top=' + top + ', left=' + left;
    params += ', directories=no';
    params += ', location=no';
    params += ', menubar=no';
    params += ', resizable=no';
    params += ', scrollbars=yes';
    params += ', status=no';
    params += ', toolbar=no';
    newwin = window.open(url, 'windowname5', params);
    if (window.focus) { newwin.focus() }
    return false;
    }
    </script>


    this will not display popwindow. If I run without passing parameters a pop window will display. But for parameters it will not displaying a popup window. whats the wrong in my code this is important and please help me

    Thanks in advance

    shubha

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,742
    Thanks
    41
    Thanked 191 Times in 190 Posts
    This seems like it may become a javascript issue and not a .Net issue...

    Can you get us some more info? If you are developing in Visual Studio, can you throw some breakpoints on the script and then step through it?

    You say it works with passing no arguments. The parameters assemble to be the following (threw in '100') for readability
    Code:
    'width=100, height=100, top=100, left=100, directories=no, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, toolbar=no';
    So try this...
    Code:
    newwin = window.open(url, 'windowname5');
    it should still work. I think the problem might* be that you don't have px called out for height/width and top/left... but I could be wrong on that.

    Anyways try the diagnostic stuff and get more info so we know "what side" this is happening on (client/server)

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •