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

Expand GridTableView and put in insert mode

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pether Wiklander
Top achievements
Rank 2
Pether Wiklander asked on 17 Feb 2009, 09:53 AM
Hi,

I'm trying to create a column in my grid with two buttons; expand/collapse and insert. The expand/collapse button should expand/collapse the child GridTableView (this is working as planned). The insert buttton should expand the child GridTableView (if not expanded) and set the child GridTableView in insert mode. I've been struggling with this for a while now but I can't seem to find any solution for it. Any suggestions on how to do this?

Best regards,
Pether

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 17 Feb 2009, 11:40 AM
Hi Pether,

Give a try with the following approach and see whether it helps.

ASPX:
 <telerik:GridTemplateColumn UniqueName="TempCol2" HeaderText="TemplateCol" > 
                       <ItemTemplate> 
                           <asp:LinkButton ID="LinkButton1" runat="server"  CommandName="Expand" >Expand</asp:LinkButton> 
                           <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Expand/Insert" >Expand/Insert</asp:LinkButton> 
                       </ItemTemplate>  
                        
                     </telerik:GridTemplateColumn> 

CS:
 protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        GridDataItem item = (GridDataItem)e.Item; 
        if (e.CommandName == "Expand"
            item.Expanded = !item.Expanded; 
 
 
        else if (e.CommandName == "Expand/Insert"
        { 
            if (!item.Expanded) 
                item.Expanded = true
 
            GridTableView childTable = (GridTableView)item.ChildItem.NestedTableViews[0]; 
            childTable.IsItemInserted = true
            childTable.Rebind(); 
             
        } 
    } 


Thanks
Princy.
Tags
Grid
Asked by
Pether Wiklander
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Share this question
or