We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid Hierarchy - Child table dosen't show

Hi

Ive created at Hierarchy grid and the grid shows just fine in my .aspx page


But when i press the row to se the child table i get this:

When i debug my code i can see that the ActionResult ChildGrid does return a result


I've hidden the row where the id is for joining but it is passed to the code behind
What am i doing wrong?

My aspx:
   @{ Html.Syncfusion().Grid<DataRow>("GridSrc").Datasource(Model)
               .Caption("Hændelser")
               .AutoFormat(Skins.Metro)
               .AllowResizing(true)
               .AllowAutoWrap(true)
               .ChildGrid(child => child.ChildGridTemplate(Html.Syncfusion().Grid<DataRow>("ChildGrid_${JoinId}").Caption("Overblik over hændelser").Mappers(map => map.Action("ChildGrid", new { joinid = "${JoinId}" })).ToChildGridTemplate())).ClientSideEvents(events => { events.OnLoad("hideGridColumn"); }).Render();
        }

My codebehind:
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult ChildGrid(PagingParams args, string joinid)
        {
            DataTable table = new DataTable("Hændelser");

            using (SqlConnection sqlCon = new SqlConnection(_sqlConString))
            {
                try
                {
                    string sqlCmdQuery = @"SELECT
                                                Navn
                                                Maaned ,
                                                Aar ,
                                                Start_Dato ,
                                                Slut_Dato ,
                                                Type ,
                                                Varighed ,
                                                [Aktiv?]
                                        FROM Statistik.VW_OverblikAlleHaendelser AS VOAH
                                        WHERE VOAH.JoinId = '" + joinid +
                                         "' ORDER BY Start_Dato";
                   
                    SqlCommand sqlCmd;

                    sqlCmd = new SqlCommand(sqlCmdQuery);
                   
                    sqlCmd.Connection = sqlCon;

                    sqlCon.Open();

                    SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCmd);
                    sqlDataAdapter.Fill(table);

                }
                catch (Exception exception)
                {

                }
                finally
                {
                    if (sqlCon.State == ConnectionState.Open)
                        sqlCon.Close();
                    sqlCon.Dispose();
                }
            }

            IEnumerable data = table.AsEnumerable().ToList();
            return data.GridActions<DataRow>();

        }

Regards

-Jacob

4 Replies

HJ Hariharan J V Syncfusion Team September 30, 2013 10:44 AM UTC

Hi Jacob,

Thanks for using Syncfusion products.

Currently we are analyzing on this issue and we will update you on two business days.

Please let us know if you need any further assistance.

Regards,
Hariharan J.V.



BM Bala Murugan A.S Syncfusion Team October 3, 2013 12:39 PM UTC

Hi Jacob,

 

Thanks for your patience.

 

We suggest you to set datasource for child grid initially to avoid your issue. Please refer the below code snippets.

 

[Index.cshtml]

  .ChildGrid(child =>
                        {
                            child.ChildGridTemplate(Html.Syncfusion().Grid<System.Data.DataRow>("ChildGrid_${OrderID}")
                            .Datasource((IEnumerable<System.Data.DataRow>)ViewData["data"])
                            .Caption("OrderDetails Grid")
                            .AutoFormat(Skins.Marble)                       
                            .EnablePaging()
                            .Mappers(map =>
                            {
                                map.Action("ChildGrid", new { OrderID = "${OrderID}" });
                            })
                            .ToChildGridTemplate());
                        })            

 

[HomeController.cs]

 public ActionResult Index()
        {
            ViewData["data"] = GetTable1(GetTable().Rows[0]["OrderID"].ToString()).AsEnumerable();
            return View(GetTable());
        }

 

For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

 

Sample: DataTable_Hierarchygrid.zip

 

Could you please check the above sample and let us know if this is helpful.

 

Please let us know if you need further assistance.

 

Regards,

Balamurugan A.S



JS Jacob Saugmann October 4, 2013 09:26 AM UTC

Hi

It worked :-)

Thanks you for your help :-)

-Jacob


HJ Hariharan J V Syncfusion Team October 7, 2013 04:41 AM UTC

Hi Jacob,

Thanks for your update.

We are glad to know that your issue has been resolved. Please let us know if you have any other concerns so that we will be happy to help you out.

Regards,
Hariharan J.V.

Loader.
Live Chat Icon For mobile
Up arrow icon