Click here to Skip to main content
13,149,738 members (56,377 online)
Rate this:
Please Sign up or sign in to vote.
hello programmers, got a few errors here that I cannot solve myself.
Ive manage to add a pop up window on my master page so that I could call it everytime
<script type="text/javascript">

        function OpenPopup() {
if (window.showModalDialog) {
    window.showModalDialog("PopUp.aspx", "PopUp",
} else {'PopUp.aspx', 'name', 'height=300,width=550,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');

See that I am calling PopUp,aspx
Now on my popup.aspx here is the trickest part
I am binding it with autocomplete extender with the source txtSearchBox
<form id="form1"  runat="server">
    <cc1:ToolkitScriptManager ID="ToolkitScriptManager1"  runat="server">
            <asp:Panel ID="Panel1" runat="server">
                <asp:Label ID="lblResult" runat="server" Visible="false" ForeColor="Red" Font-Bold="true"></asp:Label><br />
                <asp:Label ID="Label7" runat="server" Text="Search: " Width="100px"></asp:Label>
                <big><asp:TextBox ID="txtSearchBox"  OnTextChanged="txtSearchBox_TextChanged" AutoPostBack="true" Width="300px"
                    runat="server" Font-Names="verdana,arial,helvetica,sans-serif" Font-Size="XX-Small"></asp:TextBox></big>                <br />
                <br />
                <asp:Label ID="Label1" runat="server" Text="Course Code: " Width="100px"></asp:Label>
                <asp:TextBox ID="txtCourseCode" runat="server" Width="173px" Font-Names="verdana,arial,helvetica,sans-serif"
                <asp:CheckBox ID="checkMultiCode" AutoPostBack="true" Text="*multi codes" runat="server"
                    Font-Names="verdana,arial,helvetica,sans-serif" Font-Size="XX-Small" />
<%--                <div style="removed: absolute; removed 455px; removed 65px; width: 50px">
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UPanel">
                            <img alt="Update in Progress" src="Images/load.gif" height="30px" />
                <br />
                <br />
                <asp:Label ID="Label2" runat="server" Text="Course Name: " Width="100px"></asp:Label>
                <asp:TextBox ID="txtCourseName" runat="server" Width="250px" Font-Names="verdana,arial,helvetica,sans-serif"
                <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtCourseName"
                    Font-Names="verdana" Font-Size="XX-Small" ErrorMessage="Needed"></asp:RequiredFieldValidator>--%>
                <br />
                <br />
                <asp:Label ID="Label3" runat="server" Text="Duration: " Width="100px"></asp:Label>
                <asp:TextBox ID="txtCourseDuration" runat="server" Width="250px" Font-Names="verdana,arial,helvetica,sans-serif"
                <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtCourseDuration"
                    Font-Names="verdana" Font-Size="XX-Small" ErrorMessage="Needed"></asp:RequiredFieldValidator>--%>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtCourseDuration"
                    Font-Names="verdana" Font-Size="XX-Small" ErrorMessage="Numbers/Decimal Only"
                <br />
                <br />
                <br />
<%--                <div style="display:none;">
                <asp:Button ID="button2" runat="server" HorizontalAlign="right" Width="200px"
                    Text="Update" align="right"/>
                <asp:Button ID="ButtonUpdateCategory" runat="server" HorizontalAlign="right" Width="200px"
                    Text="Update" Visible="false" align="right" OnClientClick="CloseDialog()" />
                <asp:Button ID="ButtonSave" runat="server" HorizontalAlign="right" Width="200px"
                    Text="Save" align="right" />
                <asp:Button ID="btnCancel" runat="server" Width="200px" CausesValidation="false"
                    align="right" Text="Cancel" />
                <asp:Button ID="Button2" runat="server" align="right" Text="Cancel" Style="display: None" />
                <br />
                <br />
                <asp:TextBox ID="txtCourseCatID" Style="display: none" runat="server"></asp:TextBox>
                <asp:TextBox ID="txtCourseID" Style="display: none" runat="server"></asp:TextBox>
                <asp:TextBox ID="txtCode" Style="display: none" runat="server"></asp:TextBox>
                <div id="div1">
                    <cc1:AutoCompleteExtender ID="AutoCompleteExtender2"  runat="server" TargetControlID="txtSearchBox"
                        CompletionListCssClass="AutoExtenderCourse" CompletionListItemCssClass="AutoExtenderList"
                        CompletionListHighlightedItemCssClass="AutoExtenderHighlight" CompletionListElementID="div1"
                        CompletionSetCount="10" ServicePath="WebService.asmx" ServiceMethod="CourseCode"
                        CompletionInterval="10" MinimumPrefixLength="1">

See that my txtSearchbox has ontextchange and auto postback. Now i can get the value i want but then it doesnt remain in the window popup thus it transfer the value to a new window.
Protected Sub txtSearchBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSearchBox.TextChanged
        txtCourseName.text = txtSearchBox.text    End Sub
Posted 30-Jan-12 17:34pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Use callback function. You can access parent window object in javascript by using window.parent or window.opener. You can pass the variables or access the control of child to parent or parent to child window.
Learn more about on the net.
janwel 31-Jan-12 0:02am
im sorry sir but I am new to this modal window. coult you elaborate more sir?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

got it i have to add target=_self on the head of the popUp.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 6 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100