This is a migrated thread and some comments may be shown as answers.

Lose ability to select rows after updating grid with AJAX

4 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan Dailey
Top achievements
Rank 1
Ryan Dailey asked on 04 Aug 2010, 02:12 PM
I've noticed that whenever I update the RadGrid with AJAX, I always lose the ability to select rows.  They don't change when you hover over them either.  I really need to be able to use row selection.  Thanks

4 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 06 Aug 2010, 03:26 PM
Hello Ryan,

Based on the supplied information, it is hard to determine what is causing the issue.
Please provide more information on your scenario, the grid definition and the AJAX settings.
A sample working project, demonstrating your full setup and showing the unwanted behavior will be highly appreciated.

Thank you in advance for the cooperation.

Greetings,
Mira
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ryan Dailey
Top achievements
Rank 1
answered on 09 Aug 2010, 10:55 PM

If you put this control inside of a newly created Sitefinity application, you will see this behavior.  Starting out, the RadGrid displays hover styles and selects rows fine.  But, if you select one of the nodes on the TreeView, the RadGrid gets updated using AJAX.  After doing so, the new data shows up, but hover styles disappear and, most importantly, you can no longer select the rows.

TreeAndGrid.ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TreeAndGrid.ascx.cs" Inherits="UserControls_TreeAndGrid" %>
<script type="text/javascript" language="javascript">
</script>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <ClientEvents />
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rtFiles" EventName="OnNodeClick">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdFiles" LoadingPanelID="RadAjaXLoadingPanel1" />
                <telerik:AjaxUpdatedControl ControlID="ViewState" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
  
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadSplitter ID="fileExSplitter" Width="100%" runat="server">
    <telerik:RadPane ID="fileExPane1" runat="server">
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadTreeView ID="rtFiles" runat="server"
            EnableAjaxSkinRendering="true"
            AllowNodeEditing="false"
            OnNodeClick="rtFiles_NodeClick">
            <ContextMenus>
                <telerik:RadTreeViewContextMenu ID="fileContextMenu">
                    <Items>
                        <telerik:RadMenuItem Text="Rename" Value="rename" PostBack="false"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Delete" Value="delete"></telerik:RadMenuItem>
                    </Items>
                </telerik:RadTreeViewContextMenu>
                <telerik:RadTreeViewContextMenu ID="albumContextMenu">
                    <Items>
                        <telerik:RadMenuItem Text="New Album" Value="newAlbum"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Upload File" Value="uploadFile"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Rename" Value="rename" PostBack="false"></telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="Delete" Value="delete"></telerik:RadMenuItem>
                    </Items>
                </telerik:RadTreeViewContextMenu>
            </ContextMenus>
            <Nodes>
                <telerik:RadTreeNode Text="Test">
                    <Nodes>
                        <telerik:RadTreeNode Text="Testing1">
                        </telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="Testing12"></telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeNode>
                <telerik:RadTreeNode Text="Testing123">
                </telerik:RadTreeNode>
            </Nodes>
        </telerik:RadTreeView>
    </telerik:RadPane>
    <telerik:RadSplitBar ID="fileExSplit1" CollapseMode="Backward" runat="server" />
    <telerik:RadPane ID="fileExPane2" runat="server">
        <telerik:RadGrid ID="grdFiles" Width="100%" runat="server" AllowMultiRowSelection="true"
            onneeddatasource="grdFiles_NeedDataSource"
             >
            <SelectedItemStyle BackColor="Red" />
            <MasterTableView ShowHeader="true" UseAllDataFields="false" AutoGenerateColumns="false" RetrieveAllDataFields="false">
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="File Name" >
                        <HeaderStyle Width="50%" />
                        <ItemTemplate>
                            <img src="/internetsite/Images/Icons/<%# Convert.ToBoolean(Convert.ToString(DataBinder.Eval(Container.DataItem, "Title")).Contains("."))? Convert.ToString(DataBinder.Eval(Container.DataItem, "Title")).Substring(Convert.ToString(DataBinder.Eval(Container.DataItem, "Title")).LastIndexOf(".") + 1) + ".gif" : "folder.gif" %>" /> <%# DataBinder.Eval(Container.DataItem, "Title") %>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings EnableRowHoverStyle="true">
                <Selecting AllowRowSelect="true" />
            </ClientSettings>
        </telerik:RadGrid>
    </telerik:RadPane>
</telerik:RadSplitter>


TreeAndGrid.ascx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
using Telerik.Web.UI;
  
public partial class UserControls_TreeAndGrid : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            data = data1;
        }
    }
  
    GridData[] data1 = new GridData[] { new GridData(1, "Andy"), new GridData(2, "Christian"), new GridData(3, "Johnathan"), new GridData(4, "Tristan") };
    GridData[] data2 = new GridData[] { new GridData(5, "Joe"), new GridData(6, "Jeff"), new GridData(7, "Rice"), new GridData(8, "Brett"), new GridData(9, "Tracy") };
    GridData[] data;
    protected void grdFiles_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        grdFiles.DataSource = data;
    }
  
    protected void rtFiles_NodeClick(object sender, RadTreeNodeEventArgs e)
    {
        data = data2;
        grdFiles.Rebind();
    }
  
    public class GridData
    {
        public GridData(int id, string title) 
        {
            this.Id = id;
            this.Title = title;
        }
        public string Title
        {
            get
            {
                return title;
            }
            set
            {
                title = value;
            }
        }
        private string title;
  
        public int Id
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }
        private int id;
  
    }
}
0
Pavlina
Telerik team
answered on 11 Aug 2010, 09:33 AM
Hello Ryan,

I noticed that you have opened a duplicate post on the same matter. Please, refer to the other forum ticket post for additional information. To avoid duplicate posts, we can continue our communication there.

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Chris
Top achievements
Rank 1
answered on 27 Jun 2013, 04:38 PM
Do you have a link to the ticket this was to be resolved on? 
Tags
Grid
Asked by
Ryan Dailey
Top achievements
Rank 1
Answers by
Mira
Telerik team
Ryan Dailey
Top achievements
Rank 1
Pavlina
Telerik team
Chris
Top achievements
Rank 1
Share this question
or