我有一个包含多列的网格视图,但只有其中一列应该动态更改。每行都有一个“状态”值,我需要调用数据库来更新它。我已经编写了一个函数来执行该调用,但是我编写的用于更新它的当前方法会刷新整个页面。这很突兀,因为刷新会删除状态(页面其他区域中的选定值、滚动位置等)。
这是我为尝试设置而编写的代码:
<div class = "my_gridview">
<asp:Timer ID = "timer_1" OnTick = "timer_1Tick" runat = "server" Interval = "25" />
<asp:UpdatePanel ID = "update_panel" UpdateMode = "Conditional" runat = "server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID = "timer_1" EventName = "Tick" />
</Triggers>
<ContentTemplate>
<asp:GridView ID="my_gridview" runat="server" AutoGenerateColumns = "False"
GridLines="None" Width="100%" AllowSorting="True"
CssClass="table table-bordered x-condensed cameraDetails" OnRowDataBound = "my_list_RowDataBound"
EmptyDataText = "There are no generated heatmaps">
<Columns>
<asp:TemplateField meta:resourceKey = "StringSourceID">
<HeaderTemplate>
<asp:Label ID = "srcTitleLbl" runat="server" Text = "Source" />
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID = "srcLbl" runat="server" CssClass="LinkBtn_Type" meta:resourceKey="srcLblResource" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourceKey = "StringStatus">
<HeaderTemplate>
<asp:Label ID = "statusTitleLbl" runat="server" Text = "Status" />
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID = "statusLbl" runat="server" CssClass="LinkBtn_Type" meta:resourceKey="statusLblResource" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
在不刷新整个页面的情况下如何做到这一点?