2013-08-21 65 views
0

嗨,我有一個艱難的人。我有一個包含複選框列表的radgrid。現在,當用戶更改複選框時,複選框執行回發並更改行的文本和顏色。現在,當它這樣做時,它把焦點放在那一行上。因此,如果我選中該框並滾動到頁面頂部,它會將我拉回到底部。我想這樣做,所以它不會改變任何焦點,只是做一個異步回發。在autopostback上停止焦點更改= true

這裏只是從電網拉

<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> 

我非常感謝你們提供這方面的幫助。

回答

0

我找到了答案here

<script type="text/javascript"> 

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

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