0

嘿,伙计们,我遇到了一个艰难的人。我有一个包含复选框列表的 radgrid。现在,当用户更改复选框时,复选框会进行回发并更改行的文本和颜色。现在,当它执行此操作时,会将焦点拉到该行。因此,如果我选中该框并向上滚动到页面顶部,它会将我拉回底部。我想做它,所以它不会改变任何焦点,只是做一个异步回发。

这只是从网格中拉出的复选框

 <asp:CheckBox runat="server" ID="isChecked" Checked='<%# Eval("active") %>' AutoPostBack="true"
                                          OnCheckedChanged="CheckChanged" ToolTip="Activate/In-activate relationship between Event and Category" />

现在这是整个网格,里面有复选框代码。同样,我只想停止焦点变化。我希望用户能够取消选中一个框并滚动,而不必担心他们的焦点会拉回他们更改的行。

    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True"
                     CssClass="mdmGrid active" CellSpacing="0" DataSourceID="eventsINcategories" GridLines="None"
                     Width="80%" OnItemDataBound="RadGrid1_ItemDataBound">
        <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataSourceID="eventsINcategories">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridTemplateColumn UniqueName="ActiveDisabled" HeaderText="Status" AllowFiltering="false">
                    <ItemTemplate>
                        <asp:CheckBox runat="server" ID="isChecked" Checked='<%# Eval("active") %>' AutoPostBack="true"
                                      OnCheckedChanged="CheckChanged" ToolTip="Activate/In-activate relationship between Event and Category" />
                        <asp:Label ID="Label2" runat="server" ForeColor='<%# (bool)Eval("active") ? System.Drawing.Color.Green : System.Drawing.Color.Red %>'
                                   Text='<%# string.Format("{0}", (bool)Eval("active") ? "Active" : "In-Active") %>'></asp:Label>
                        <asp:Label runat="server" ID="hidd_CategoryID" Text='<%# Eval("categoryID") %>' Style="display: none; color:Red;"></asp:Label>
                        <asp:Label runat="server" ID="hidd_eventID" Text='<%# Eval("eventID") %>' Style="display: none;"></asp:Label>
                        <asp:Label runat="server" ID="hide_EventActivation" Text='<%# DataBinder.Eval(Container.DataItem, "eventActivation") %>' Visible="false"></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width="100px" />
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="eventDetail" FilterControlAltText="Filter eventDetail column"
                                         HeaderText="Event and Event Codes" ReadOnly="True" SortExpression="eventDetail"
                                         UniqueName="eventDetail">
                    <ItemStyle Width="200px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="categoryName" FilterControlAltText="Filter categoryName column"
                                         HeaderText="Category" SortExpression="categoryName" UniqueName="categoryName">
                    <ItemStyle Width="100px" />
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="NotifyOptions" HeaderText="Notify Options" AllowFiltering="true" SortExpression="NotifyOptions">
                    <ItemTemplate>
                        <asp:Label ID="notifyOptionsText" runat="server" Text=""></asp:Label>
                        <asp:Label runat="server" ID="notifyEmail" Text='<%# DataBinder.Eval(Container.DataItem, "notifyEmail") %>' Visible="false"></asp:Label>
                        <asp:Label runat="server" ID="notifyTextMessage" Text='<%# DataBinder.Eval(Container.DataItem, "notifyTextMessage") %>' Visible="false"></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width="100px" />
                </telerik:GridTemplateColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
            <BatchEditingSettings EditType="Cell" />
            <PagerStyle PageSizeControlType="RadComboBox" AlwaysVisible="true"></PagerStyle>
        </MasterTableView>
        <PagerStyle PageSizeControlType="RadComboBox" />
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>

我非常感谢你们可以提供的任何帮助。

4

1 回答 1

0

我在这里找到了答案

<script type="text/javascript">

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_beginRequest(function() {
    prm._scrollPosition = null;
});

于 2013-08-21T17:53:03.230 回答