Click here to Skip to main content
15,879,535 members

pop up windows wherein textbox_onchange doesnt work?

janwel asked:

Open original thread
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
XML
<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.
VB
Protected Sub txtSearchBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSearchBox.TextChanged
        txtCourseName.text = txtSearchBox.text    End Sub
Tags: Javascript, .NET, ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900