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

Expand/Collapse column causes Page Error after Rebind()

3 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 14 Jan 2010, 06:48 PM
Hello,

I have an Ajaxified RadGrid with a nestedViewTemplate beneath the MasterTableView. On the nested template, there is a RadTabStrip with two tabs, each containing another RadGrid. The main grid and the nested grids all use cached datasets as their datasources, so they are configured with the NeedDataSource events.

I have a method which clears the cache and then calls the Rebind method of the main grid (thus undoing any changes the user made to the data), which repopulates the cache and binds it to the grid. The problem I am having is this: after the rebind method is called from this method, I cannot expand any rows in the master table view. When I click the 'Expand' button after calling this method, the IE status bar changes from 'Done' to 'Error on Page' only if one of the sub-grids had a row in edit mode prior to the rebind. The details of the error are:
Line: 6503
Char: 28
Error: Object required
Code: 0
URL: [aspx page url]

I have noticed that if I click any other itemCommands (edit/delete) after this error has occurred, the Grid causes a full postback and then I am able to expand the rows.

I have tried both setting the datasource to null or an empty object before rebinding, and looping through the grid items before rebinding and setting Edit=false or Expanded=false. Neither of these had any result.

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 20 Jan 2010, 07:04 AM
Hello Josh,

I suspect there is a problem with the way the grid is databound. Can you please supply the code, which you are using to populate the main grid with data?

Best wishes,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Josh
Top achievements
Rank 1
answered on 20 Jan 2010, 03:08 PM
Hello Yavor,

Thanks for replying. The structure of the grid in aspx is:

<telerik:RadGrid id="mainGrid" OnNeedDataSource="mainGrid_NeedDataSource"
    <MasterTableView HierarchyLoadMode="ServerOnDemand"
        <NestedViewTemplate> 
        <div> 
            <asp:Panel ID="InnerContainer"
            <telerik:RadTabStrip> 
                <Tabs> 
                <telerik:RadTab PageView="SubPage1" /> 
                <telerik:RadTab PageView="SubPage2" /> 
            </Tabs> 
            </telerik:RadTabStrip> 
        <telerik:RadMultiPage> 
            <telerik:RadPageView id="SubPage1"
            <telerik:RadGrid id="subGrid1" OnNeedDataSource="subGrid1_NeedDataSource"
                <MasterTableView> 
                    <Columns /> 
                        <EditFormSettings> 
                    <FormTemplate> 
                        <!--edit form controls--> 
                    </FormTemplate> 
                    </EditFormSettings> 
                </MasterTableView> 
            </telerik:RadGrid> 
            </telerik:RadPageView> 
            <telerik:RadPageView id="SubPage2"
            <telerik:Radgrid id="subGrid2" OnNeedDataSource="subGrid2_NeedDataSource" OnDetailTableDataBind="subGrid2_DetailTableDataBind"
                <MasterTableView> 
                <DetailTables> 
                    <telerik:GridTableView> 
                    <ParentTableRelation /> 
                    <Columns /> 
                    <EditFormSettings> 
                        <FormTemplate> 
                            <!--edit form controls--> 
                        </FormTemplate> 
                        </EditFormSettings> 
                    </telerik:GridTableView> 
                </DetailTables> 
                    <Columns /> 
                    <EditFormSettings> 
                    <FormTemplate> 
                        <!--edit form controls--> 
                    </FormTemplate> 
                    </EditFormSettings> 
                </MasterTableView> 
            </telerik:RadGrid> 
            </telerik:RadPageView> 
        </telerik:RadMultiPage> 
            </asp:Panel> 
        </div> 
        </NestedViewTemplate> 
    <Columns /> 
    <EditFormSettings> 
        <FormTemplate> 
            <!--edit form controls--> 
        </FormTemplate> 
    </EditFormSettings> 
    </MasterTableView> 
</telerik:RadGrid> 

The code behind for databinding is:
protected void mainGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    DataSet ds = GetMainDataSet(); 
    DataView dv = ds.DefaultView; 
    mainGrid.DataSource = dv; 
 
protected void subGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    string key = "[get key from nestedViewTemplate]"
    DataSet ds = GetSubDataSet1(key); 
    DataView dv = ds.DefaultView; 
    (source as RadGrid).DataSource = dv; 
 
protected void subGrid2_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    string key = "[get key from nestedViewTemplate]"
    DataSet ds = GetSubDataSet2(key); 
    DataView dv = ds.DefaultView; 
    (source as RadGrid).DataSource = dv; 
 
protected void subGrid2_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e) 
    GridDataItem item = (GridDataItem)e.DetailTableView.ParentItem; 
    string key1 = item["key1"].Text; 
    string key2 = item["key2"].Text; 
    DataSet ds = GetDetailData(key1, key2); 
    DataView dv = ds.DefaultView; 
    e.DetailTableView.DataSource = dv; 

Some of the details have been removed. The rebind() method generally works fine, but if subGrid1 or subGrid2 has an item in edit mode when it is called, then I get the page error. Maybe there is a way to un-bind the grid or drop the data from it? The datasets are stored in session cache so dropping them from the grid would not be an issue.

Thanks,
Josh
0
Yavor
Telerik team
answered on 25 Jan 2010, 09:38 AM
Hello Josh,

I reviewed the code, and it looks correct.
If the issue persists at your end, you can open a formal support ticket, and send us a small working project, demonstrating your setup, and showing the unwanted exception.
We will debug it locally, and get back to you with more information on the matter.

Greetings,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Josh
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Josh
Top achievements
Rank 1
Share this question
or