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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Hierarchy - Child table dosen't show

Thread ID:

Created:

Updated:

Platform:

Replies:

112483 Sep 25,2013 06:14 AM UTC Oct 7,2013 04:41 AM UTC ASP.NET MVC (Classic) 4
loading
Tags: Grid
Jacob Saugmann
Asked On September 25, 2013 06:14 AM UTC

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

Hariharan J V [Syncfusion]
Replied On 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.


Bala Murugan A.S [Syncfusion]
Replied On 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


Jacob Saugmann
Replied On October 4, 2013 09:26 AM UTC

Hi

It worked :-)

Thanks you for your help :-)

-Jacob

Hariharan J V [Syncfusion]
Replied On 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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;