现在页面中有一个updatepanel1,一个gridview1,在gridview1中有个模板列,采用的checkbox1,现在想要点击checkbox,使得updatepanel1能够更新,该如何设置啊?
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate></ContentTemplate>
                                        <Triggers>
                                            <asp:AsyncPostBackTrigger ControlID="GridView1" 
                                                EventName="SelectedIndexChanging" />
                                          <asp:AsyncPostBackTrigger ControlID="checkbox1" EventName="CheckedChanged" />
                                        </Triggers>
                            </asp:UpdatePanel>     <asp:GridView ID="GridView1" runat="server">
        <HeaderStyle Font-Bold="True" ForeColor="White" Height="24" 
                            HorizontalAlign="Center" VerticalAlign="Middle" CssClass="Freezing"/>
        <Columns>
                <asp:TemplateField HeaderText="选择" ItemStyle-Width="30" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
    <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged"/>
                                </ItemTemplate>
                            </asp:TemplateField>
                     </Columns>
    </asp:GridView> 用上面这种方法不行。

解决方案 »

  1.   

    如果是我,可能在GridView.RowDataBound事件里为CheckBox1增加Attribute, 执行一个js.
    用js来更新UpdatePanel,var prm = Sys.WebForms.WebRequestManager.getInstance(); prm.Update('UpdatePanel1', null);具体代码忘了,差不多这样。
      

  2.   

    checkbox加个js onclick调用后台ajaxMethod
      

  3.   

    在CheckBox1_CheckedChanged里更新数据或通过js异步调用ajax更新数据
      

  4.   

    checkbox的AutoPostBack="True" 在将updatepanel1 设置为ChildrenAsTriggers="True" 。应该可以吧,我猜的呵呵。不能话楼主不要骂我~~
      

  5.   

    因为你CheckBox1设置了AutoPostBack="true" ,可以试试直接调用UpdatePanel1的Update方法!!    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
        {
            UpdatePanel1.Update();
        }
      

  6.   

    因为你CheckBox1设置了AutoPostBack="true" ,可以试试直接调用UpdatePanel1的Update方法!!     protected void CheckBox1_CheckedChanged(object sender, EventArgs e) 
        { 
            UpdatePanel1.Update(); 
        }