且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何触发一个UpdatePanel由一个TextBox控件?

更新时间:2023-11-30 15:39:22

您可以做到这一点,以刷新的UpdatePanel没有按钮:

You can do this to refresh your updatepanel without the button:

<script type="text/javascript">

    function refreshPanel() {
        __doPostBack('<%= updatePanel.UniqueID %>', '');
    }

</script>
<label>Search:</label>
<asp:TextBox runat="server" ID="search"  
                ClientIDMode="Static" OnKeyUp="refreshPanel();" />
<asp:UpdatePanel runat="server" ID="updatePanel">

您只需要给你的UpdatePanel一个ID(这里的UpdatePanel)

You just need to give your updatepanel an ID (updatePanel here)

执行了code在KEYUP或当你已经准备好了。

Execute that code on a keyup or whenever you are ready for it.