a rwo questions about radgrid

5 posts, 2 answers
  1. Łukasz Kuryło
    Łukasz Kuryło avatar
    24 posts
    Member since:
    Jan 2010

    Posted 02 Feb 2010 Link to this post

    Hi all.
    Sorry if my questions cover basics, but this is my second day with Telerik controls.

    Both my questions are connected with this example http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultcs.aspx

    1. I want to remove the first column with arrow and have possibility to expand the hierarchy when I click on the row. If someone could steer me how to achieve that in the simplest way I would be grateful.
    2. After expanded the row, next in hierarchy are shifted to the right. I want to have them one by one without it. How to do that?

  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 03 Feb 2010 Link to this post

    Hello Łukasz,

    Inorder to hide the Expand and Collapse images from your grid, you can use the following css style setting:
    .rgExpand,.rgCollapse {visibility:hidden !important;} 

    Also here's an example of how to expand rows in the grid by clicking on the them:
    <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" AutoGenerateColumns="true" runat="server"
       <MasterTableView DataSourceID="SqlDataSource1" Name="Master"
                <telerik:GridTableView DataSourceID="SqlDataSource1" Name="Detail1" runat="server"
                         <telerik:GridTableView DataSourceID="SqlDataSource1" runat="server" Name="Detail2"
       <ClientSettings EnablePostBackOnRowClick="true">                
    Note: Set the ClientSettings<EnablePostBackOnRowClick for the grid to true.
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
            if (e.CommandName == "RowClick" && (e.Item.OwnerTableView.Name == "Master" || e.Item.OwnerTableView.Name == "Detail1")) 
                e.Item.Expanded = !e.Item.Expanded;           

    Hope this helps..
  3. Łukasz Kuryło
    Łukasz Kuryło avatar
    24 posts
    Member since:
    Jan 2010

    Posted 05 Feb 2010 Link to this post

    Hi Princy.
    Thank you for your reply.

    Hiding elements on the page with css is IMO a "dirty" practise. Yes, I've asked about the easiest way, but is here available other possibility to do that?

    The EnablePostBackOnRowClick works properly, but after I click on the row, there is a small delay. How can I define how long this delay lasts?

    I have a one more question.

    I have own control inherited from RadGrid in other assembly. In OnInit method in this assembly I have definied
    protected override void OnInit(EventArgs e) 
                this.PageSize = 20;  

    But now in the Default.aspx when I using this control I want to have the possibility to change manually this properly.
     <xx:control PageSize=x /> doesn't work.
    Maybe the OnInit isn't the best place to set this property on the start. Where should I add it?
  4. Łukasz Kuryło
    Łukasz Kuryło avatar
    24 posts
    Member since:
    Jan 2010

    Posted 08 Feb 2010 Link to this post

    Really no one know how to resolve the problem with this PageSize property?
    The delay which I mentioned is probable due to the large amount of data which the grid loads. But the second problem still exist.
  5. Answer
    Yavor avatar
    11 posts

    Posted 11 Feb 2010 Link to this post

    Hi Łukasz,

    Presently, with respect to hiding the expand collapse column, there is no other way to handle this functionality.
    Additionally, with respect to the pagesize property, you can set it when the control is declared, rather than in the onInit handler.
    I hope this is a feasible approach for you.

    All the best,
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top