弹出窗口,其中textbox_onchange不起作用? [英] pop up windows wherein textbox_onchange doesnt work?

查看:68
本文介绍了弹出窗口,其中textbox_onchange不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,程序员在这里遇到了一些我无法解决的错误.
香港专业教育学院设法在我的母版页上添加一个弹出窗口,以便我每次都可以调用它

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>


看到我正在打电话给PopUp,aspx
现在在我的popup.aspx上,这是最棘手的部分
我将其与带有源txtSearchBox的自动完成扩展器绑定在一起


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>


看到我的txtSearchbox具有ontextchange和自动回发.现在我可以获取想要的值,但是它不会保留在窗口弹出窗口中,因此它将值转移到新窗口中.


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

推荐答案

)|(^ [1-9] + \ d * \.\ d *
)|(^[1-9]+\d*\.\d*


)></asp:RegularExpressionValidator> < br/> < br/> < br/> <%-< div style ="display:none;"> < asp:Button ID ="button2" runat ="server" Horizo​​ntalAlign ="right" Width ="200px" Text ="Update" align ="right"/> </div>-%> < asp:Button ID ="ButtonUpdateCategory" runat ="server" Horizo​​ntalAlign ="right" Width ="200px" Text ="Update" Visible ="false" align ="right" OnClientClick ="CloseDialog()"/> < asp:Button ID ="ButtonSave" runat ="server" Horizo​​ntalAlign ="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 =服务器" 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>
)"></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>


看到我的txtSearchbox具有ontextchange和自动回发.现在我可以获取想要的值,但是它不会保留在窗口弹出窗口中,因此它将值转移到新窗口中.


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


使用回调函数.您可以使用window.parent或window.opener在javascript中访问父窗口对象.您可以将变量传递或访问子控件到父窗口或父控件到子窗口的窗口.
了解更多有关网上的信息.
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.


这篇关于弹出窗口,其中textbox_onchange不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆