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

Programatically Bind HierachicalGrid

4 Answers 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Phaneendra
Top achievements
Rank 1
Phaneendra asked on 22 Jun 2012, 02:12 PM
Hi,
I have a RadGridview, while displays stock data.
Now, I have list which list which holds Customized Stock List.
At this point i want to display this Customized stock List under relevant stock data row.
I'had approached in design time and did the work,but thing is that [+] Symbol is appearing for all the rows. But i need for only those stock rows which has cutomized list.
I've approached this tutorial. But this is displaying [+] symbol for each row and not able to display relevant data, its displaying raw data. 

Once Please look into the Issue.
protected void AddDetailsTable()
        {
            GridTableView gvCylinderList = new GridTableView(gridMapModel);
            gvCylinderList.Name = "gvCylinderList";
            gvCylinderList.AutoGenerateColumns = false;
            gridMapModel.MasterTableView.DetailTables.Add(gvCylinderList);
            GridBoundColumn clName = new GridBoundColumn();
            clName.DataField = "Name";
            clName.HeaderText = "Name";
            gvCylinderList.Columns.Add(clName);
 
            gridMapModel.DetailTableDataBind+=new GridDetailTableDataBindEventHandler(gridMapModel_DetailTableDataBind);
        }

Above Snippet for programatically adding the row.
protected void gridMapModel_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
       {
           GridDataItem item = (GridDataItem)e.DetailTableView.ParentItem;
 
           switch (e.DetailTableView.Name)
           {
               case "gvCylinderList":
                   int mapModelId = Convert.ToInt32(item.GetDataKeyValue("MapModelId"));
                   VesselService vs = new VesselService();
                   List<MapModelCylinder> lst =  GetMapModelCylinderList(vs.GetMapModelsCylinder(mapModelId));
                   if (lst.Count > 0)
                   {
                       e.DetailTableView.DataSource = lst;
                   }
                       break;
           }
       }

In the above I'm binding the Detail Table View. But its now working properly. Kindly assist me in fixing. 

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 22 Jun 2012, 04:01 PM
Hello,

More about the conventions about how to generate Telerik RadGrid structure programmatically you can find in the online resources below:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/hierarchy/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/grid-programmatic-creation.html (refer to Create hierarchy grid programmatically section)

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Keith
Top achievements
Rank 1
answered on 25 Jun 2012, 09:48 AM
Hi Pavina

I am also using the programmatic binding but now I am struggling to calculate the total column of child RadGrid and display it on a parent Grid, how can I achieve it  

Thanks


 
0
Pavlina
Telerik team
answered on 28 Jun 2012, 02:27 PM
Hi,

Can you elaborate a bit more what exactly you want to achieve?

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Pavlina
Telerik team
answered on 28 Jun 2012, 02:55 PM
Hello Edward,

Meanwhile you can examine the forum thread below which elaborates on similar subject:
http://www.telerik.com/community/forums/aspnet-ajax/grid/totaling-hierarchical-data.aspx

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Phaneendra
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Keith
Top achievements
Rank 1
Share this question
or