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

a rwo questions about radgrid

4 Answers 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Łukasz Kuryło
Top achievements
Rank 1
Łukasz Kuryło asked on 02 Feb 2010, 08:05 PM
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?

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 03 Feb 2010, 06:52 AM
Hello Łukasz,

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

Also here's an example of how to expand rows in the grid by clicking on the them:
aspx:
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" AutoGenerateColumns="true" runat="server"
   <MasterTableView DataSourceID="SqlDataSource1" Name="Master"
       <DetailTables> 
            <telerik:GridTableView DataSourceID="SqlDataSource1" Name="Detail1" runat="server"
                <DetailTables> 
                     <telerik:GridTableView DataSourceID="SqlDataSource1" runat="server" Name="Detail2"
                     ..... 
                     </telerik:GridTableView> 
                </DetailTables> 
                     ......       
            </telerik:GridTableView> 
       </DetailTables> 
        ....                 
   </MasterTableView> 
   <ClientSettings EnablePostBackOnRowClick="true">                
   </ClientSettings> 
</telerik:RadGrid> 
Note: Set the ClientSettings<EnablePostBackOnRowClick for the grid to true.
c#:
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..
Princy.
0
Łukasz Kuryło
Top achievements
Rank 1
answered on 05 Feb 2010, 01:07 PM
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;  
            base.OnInit(e); 
        } 

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?
0
Łukasz Kuryło
Top achievements
Rank 1
answered on 08 Feb 2010, 07:51 AM
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.
0
Accepted
Yavor
Telerik team
answered on 11 Feb 2010, 06:08 AM
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,
Yavor
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.
Tags
Grid
Asked by
Łukasz Kuryło
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Łukasz Kuryło
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or