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

RadGrid + multiview

2 Answers 144 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 14 Jan 2009, 03:32 PM
Greetings.
I have following trouble with rad grid:

1. i have control with self-referencing hierarchy grid with hierarchyloadmode="Client"
in ItemCreated i wrote following things:
a) check for all list elements to remove button from expandcollapse column
b) for every element i use e.Item.ExpandHierarchyToTop(); to manually open all tree (this is done to not open list nodes, which have no child and even no button,since i removed it)
c) populating my control from one column with data from e.item.dataitem

2. i put grid in new page with asp:multiview, plus added another empty view and button to move between em.

3a. whenever grid view is set as default to show - all work nice, button click make change from grid page to empty and back.

3b. whenever empty page is set as default and i push button, i got exception on "e.Item.ExpandHierarchyToTop();"
NullReferenceException, while e.item and even e.item.dataitem are populated with needed data.

2 Answers, 1 is accepted

Sort by
0
Alexander
Top achievements
Rank 1
answered on 15 Jan 2009, 10:09 AM
Update:

We have localized the problem, it looks like following:

On 1st load of multiview, if view with my control (with grid in it) is not setted as active (which i cant make unfortunally) its viewstate aint loading; so when i change active page with button click i have nothing to display in table.

After changing active view back to previous and again back to my, i have data populated, but skins arent working.

While using client-side radgrid i cant turn off viewstateenable for multiview, which helps in such cases.

Any known solutions?
0
Georgi Krustev
Telerik team
answered on 19 Jan 2009, 09:31 AM
Hi Alexander,

Straight onto your questions:

1. a) To hide expand/collapse button just hide the whole expand/collapse column.

Here is a code snippet demonstrating this approach:
    protected void RadGrid1_ColumnCreated(object sender, Telerik.Web.UI.GridColumnCreatedEventArgs e) 
    { 
        if (e.Column is GridExpandColumn) 
        { 
            e.Column.Visible = false
        } 
        else if (e.Column is GridBoundColumn) 
        { 
            e.Column.HeaderStyle.Width = Unit.Pixel(100); 
        } 
    } 

    b) To expand all items you can just set HierarchyDefaultExpanded of the MasterTableView to true.

    c) Please can you clarify what exactly you are doing on this point? Thus I will do my best to advice you further

2. Another important point is how you bind the grid? The problem with the missing grid on first load maybe is caused by not properly bound grid.

For your further convenience I attached a test project, which I hope implements the logic which you described so far. Please examine it and tell me if I am missing something.

Kind regards,
Georgi Krustev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Alexander
Top achievements
Rank 1
Answers by
Alexander
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or