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

NestedViewTemplate - first item not expanded

2 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JonathanElsner
Top achievements
Rank 1
JonathanElsner asked on 01 Aug 2011, 08:27 PM
I am following the demo from this link http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx except I am working in a VS2010 visualWebPart project for Sharepoint2010.

Is there a way to have the same loadOnDemand functionality this demo provides but without the first item being expanded by default?
 protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                RadGrid1.MasterTableView.Items[0].Expanded = true;
                RadGrid1.MasterTableView.Items[0].ChildItem.FindControl("InnerContainer").Visible = true;
            }
        }

If I remove "RadGrid1.MasterTableView.Items[0].Expanded = true;", I get the below javascript error
Sys.ArgumentUndefinedException: Value cannot be undefined.
Parameter name: type

I have been messing with this for awhile now and can only get it to work with that first item expanded.

2 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 04 Aug 2011, 05:50 PM
Hello Jonathanelsner,

 Do you also get this exception if you remove both lines:

if (!Page.IsPostBack)
{
       //RadGrid1.MasterTableView.Items[0].Expanded = true;
       //RadGrid1.MasterTableView.Items[0].ChildItem.FindControl("InnerContainer").Visible = true;
}

Also if the error persist you can temporarily turn off the ajax to see the full stack trace of the exception.Kind regards,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
JonathanElsner
Top achievements
Rank 1
answered on 04 Aug 2011, 06:18 PM
I got it working by placing controls on the page as follows
<telerik:RadTabStrip runat="server" ID="xx" >
</telerik:RadTabStrip>
<telerik:RadMultiPage runat="server" ID="xxx" >
</telerik:RadMultiPage>
I think the problem is just registering the scripts in Sharepoint via Ajax, so putting these on the page when it loads gets the scripts registered and everything is working good.

Thanks.
Tags
Grid
Asked by
JonathanElsner
Top achievements
Rank 1
Answers by
Marin
Telerik team
JonathanElsner
Top achievements
Rank 1
Share this question
or