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

Can I add a radGrid to a nestedViewTemplate

9 Answers 281 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 17 Nov 2010, 04:45 PM
I am currently making a 3-tier Hierarchy using rad grids, however for some reason the last rad grid in the hierarchy is not being recognized by Visual studio 2008 (i.e. it is not being added to the designer class).

<telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0" RenderSelectedPageOnly="false">
<telerik:RadPageView ID="RadPageView1" runat="server">
   
<telerik:RadGrid ID="radGrd1">
       
<MasterTableView>
           
<DetailTables>
               
<telerik:GridTableView>
                   
<NestedViewTemplate>
                       
<telerik:RadMultiPage>
                           
<telerik:RadPageView>
                               
<%--add Radgrid Here--%>
                           
</telerik:RadPageView>
                       
</telerik:RadMultiPage>
                   
</NestedViewTemplate>
               
</telerik:GridTableView>
           
</DetailTables>
       
</MasterTableView>
   
</telerik:RadGrid>
</telerik:RadPageView>
Here is a skeleton of the code i am using.

Is it possible to add a rad grid in that position? If so why is it that visual studio is not adding this code to the designer class and thus making it inaccessible in the code behind file?

I have tried adding the control manually myself, although it appears in the intellisense the control itself is set to null during runtime thus making it impossible to bind any data to the Grid.

Please Help

9 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 22 Nov 2010, 11:07 AM
Hi Michael,

I recommend that you examine the online example below which demonstrates a similar functionality and let me know if it helps:
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx

Regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart 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
Michael
Top achievements
Rank 1
answered on 22 Nov 2010, 04:44 PM
Thanks for the link,  i seem to have solved the problem to a certain extent.  The fact that my controls reside in a nested view template mean that they are not accessible in the traditional sense from the code behind as they are placed in a naming container...Instead a cast is needed.

protected void radGrdEnquiriesComments_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    RadGrid temp = (RadGrid)sender;
}

However i am still encountering a problem.  i would like to bind data to this rad grid when an item is expanded in the details table,  could you please point me in the right direction
0
Accepted
Pavlina
Telerik team
answered on 23 Nov 2010, 04:40 PM
Hi Michael,

Attached to this message is a sample working project that demonstrates how you can achieve the desired functionality. Please check it out and see if it works for you.

Sincerely yours,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart 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
Michael
Top achievements
Rank 1
answered on 24 Nov 2010, 01:58 PM
Thanks for the reply,

Your solution was really appreciated and it shed more insight onto how the tree of controls is built in telerik.

For anyone going through this thread in the future the following code managed to solve the problem at hand

protected void radGrdEnquiries_ItemCommand(object source, GridCommandEventArgs e)
{
GridDataItem dataItem = e.Item as GridDataItem;
GridNestedViewItem nestedItem = (GridNestedViewItem)dataItem.ChildItem;
RadGrid radGrdEnquiriesVarients = (RadGrid)nestedItem.FindControl("radGrdEnquiriesVarients");
}
0
Rodney King
Top achievements
Rank 1
answered on 06 Aug 2011, 12:33 AM
I tried to use this demo code.  Copied it into VS2010.  Save the file.  Look at the designer class-RADGRID2 is gone everytime you save.  Does anyone have a solution to this?  Is this nested grid method a viable solution?
0
Pavlina
Telerik team
answered on 09 Aug 2011, 04:02 PM
Hi Rodney King,

Can you please elaborate a bit more what is the exact issue you are facing? It will be best if you isolate the problem in a sample project and send it to us via formal support ticket. Thus we will be able to review it locally and advice you further.

Kind regards,
Pavlina
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
Rodney King
Top achievements
Rank 1
answered on 09 Aug 2011, 05:07 PM
You can simply take the attached zip that that you have on this post, put it in the VS2010IDE, open the aspx page and click save.   Notice the embedded grid is NO LONGER in the designer class with events and therefore cannot be manipulated in the normal fashion in the VS2010 IDE.  This appears to be a bug.  Never seen this before.
0
Rodney King
Top achievements
Rank 1
answered on 09 Aug 2011, 09:33 PM

Simply create a new webform and paste this in aspx source window in VS 2010.  Look at the designer class.  Do you see RadGrid2 in there?  Go to the aspx.vb try to reference radgrid2-it does not exist.  So, seems there is a little bug here - what is the workaround?   I am doing the addhandlers and they are working however where do I define Radgrid2-as a private?  A public?  Somehow get it to stay in the designer class?  Please advise.

 

 

 

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">  

<MasterTableView DataKeyNames="CustomerID">

 <NestedViewTemplate>

  <telerik:RadGrid ID="RadGrid2" runat="server" AllowPaging="True" OnNeedDataSource="RadGrid2_NeedDataSource">  

 </telerik:RadGrid>
</NestedViewTemplate>  

 </MasterTableView>

  </telerik:RadGrid>

 

 </telerik:RadAjaxPanel>

  

0
Pavlina
Telerik team
answered on 12 Aug 2011, 03:34 PM
Hello Rodney King,

To be able to initialize the inner RadGrid you need to find it first in your upper RadGrid's ItemCreated event as shown below:
void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    if (e.Item is GridNestedViewItem) 
    
          GridNestedViewItem item = e.Item as GridNestedViewItem;
          RadGrid grid = (RadGrid)e.Item.FindControl("innerGridId");
    }
         

Greetings,
Pavlina
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.

Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Michael
Top achievements
Rank 1
Rodney King
Top achievements
Rank 1
Share this question
or