简体   繁体   中英

Full postback instead of partial postback

I need to update an UpdatePanel on onkeyup event of textbox, I've writed this code:

<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="elenco.aspx.vb" Inherits="GestioneCommesse.WebForm1" EnableEventValidation = "false"%>

<asp:Content ID="BodyContent" ContentPlaceHolderID="Main" runat="server">
   <asp:CheckBox ID="chc_tutti_anni" runat="server" Text="Cerca in tutti gli anni" AutoPostBack="true" style="top: 151px; left: 10px; position: absolute; " />
   <asp:TextBox ID="txt_commessa" runat="server" onkeyup="javascript:__doPostBack('<%= UpdatePanel1.UniqueID %>','')" style="top: 90px; left: 250px; position: absolute; width: 199px"></asp:TextBox>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
        <ContentTemplate>

        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="chc_tutti_anni" EventName="CheckedChanged" />
        </Triggers>
</asp:UpdatePanel>

The problem is that the javascript:__doPostBack('<%= UpdatePanel1.UniqueID %>','') performs a full page postback, instead of postpack only the UpdatePanel.

On event CheckedChange everything is fine.

I've also tried this line:

<asp:TextBox ID="txt_commessa" runat="server" onkeyup="javascript:__doPostBack('<%= UpdatePanel1.UniqueID %>','')" autopostback="true" style="top: 90px; left: 250px; position: absolute; width: 199px"></asp:TextBox>

Someone could help me?

------EDIT------

I've just tried this solution, same problem How to trigger an UpdatePanel by a TextBox control?

------EDIT------

The question still unsolved, please help me.

您的textbox应位于UpdatePanel->ContentTemplate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM