Click here to Skip to main content
11,479,170 members (45,360 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Javascript .NET
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",
"dialogWidth:550px;dialogHeight:300px");
} else {
window.open('PopUp.aspx', 'name', 'height=300,width=550,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
}
}
    </script>
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">
    </cc1:ToolkitScriptManager>
 
            <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"
                    Font-Size="XX-Small"></asp:TextBox>
                <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">
                        <ProgressTemplate>
                            <img alt="Update in Progress" src="Images/load.gif" height="30px" />
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                </div>--%>
                <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"
                    Font-Size="XX-Small"></asp:TextBox>
                <%--<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"
                    Font-Size="XX-Small"></asp:TextBox>
                <%--<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"
                    ValidationExpression="(^\d*\.?\d*[1-9]+\d*$)|(^[1-9]+\d*\.\d*$)"></asp:RegularExpressionValidator>
                <br />
                <br />
                <br />
<%--                <div style="display:none;">
                <asp:Button ID="button2" runat="server" HorizontalAlign="right" Width="200px"
                    Text="Update" align="right"/>
                    </div>--%>
                <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">
                    </cc1:AutoCompleteExtender>
                </div>
            </asp:Panel>
 
    </form>
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 18:34pm
janwel1.9K
Rate this: bad
good
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
  Permalink  
Rate this: bad
good
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.
  Permalink  
Comments
janwel at 31-Jan-12 0:02am
   
im sorry sir but I am new to this modal window. coult you elaborate more sir?

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 215
1 OriginalGriff 205
2 F-ES Sitecore 185
3 Frankie-C 120
4 DamithSL 85
0 Sergey Alexandrovich Kryukov 7,890
1 OriginalGriff 7,441
2 Sascha Lefèvre 3,064
3 Maciej Los 2,491
4 Richard Deeming 2,335


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 6 Feb 2012
Copyright © CodeProject, 1999-2015
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