嗨在更新面板中使用GridView,但它不是部分刷新GridView我會把CheckBox放在ItemTemplate裏面並設置它們的觸發器當我檢查CheckBox時,整個gridview會刷新但是我只想刷新尊敬的行,當我將檢查複選框在這裏我顯示完整的代碼。
更新面板不是部分刷新GridView
<ContentTemplate>
<asp:GridView ID="gvrank" class="table table-bordered" runat="server" GridLines="None" Width="470px" ForeColor="#333333"
AutoGenerateColumns="False" OnDataBound="gvrank_DataBound" OnRowDataBound="gvrank_RowDataBound">
<AlternatingRowStyle BackColor="White" ForeColor="#284775"></AlternatingRowStyle>
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkBxHeader5" onclick="javascript:HeaderClick5(this);" OnCheckedChanged="chkBxHeader5_CheckedChanged" AutoPostBack="true" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:UpdatePanel ID="up" UpdateMode="Conditional" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="chkBxSelect5" EventName="CheckedChanged" />
<asp:AsyncPostBackTrigger ControlID="gvrank" EventName="DataBound" />
</Triggers>
<ContentTemplate>
<asp:CheckBox ID="chkBxSelect5" runat="server" AutoPostBack="true" OnCheckedChanged="chkBxSelect5_CheckedChanged" />
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
<ItemStyle Width="5%" HorizontalAlign="Center" />
<HeaderStyle Width="5%" HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Rank">
<ItemTemplate>
<asp:HiddenField ID="lblrankids" runat="server" Value='<%# Bind("rankid") %>'></asp:HiddenField>
<asp:Label ID="lblranks" runat="server" Text='<%# Bind("rank") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle Width="90%"></HeaderStyle>
<ItemStyle Width="90%"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="No of days">
<ItemTemplate>
<asp:TextBox ID="txtdays" runat="server" Width="68px"></asp:TextBox>
</ItemTemplate>
<HeaderStyle Width="30%"></HeaderStyle>
<ItemStyle Width="30%"></ItemStyle>
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#999999"></EditRowStyle>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"></FooterStyle>
<HeaderStyle BackColor="#5D7B9D" ForeColor="WhiteSmoke"></HeaderStyle>
<PagerStyle HorizontalAlign="Center" BackColor="#284775" ForeColor="White"></PagerStyle>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333"></RowStyle>
<SelectedRowStyle BackColor="LightSteelBlue" Font-Bold="True" ForeColor="#333333"></SelectedRowStyle>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
請幫我先生 –