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

Client Side Selection Grid Issue

6 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Staci
Top achievements
Rank 1
Staci asked on 26 Jul 2012, 10:34 AM
Hey,

I'm trying to follow the Grid Demo with Client Side Selection. I have managed to alter the code to accommodate my database, and when I build the solution I get no errors, and when I run it and navigate to my alerts page my grids are displayed but the page hangs and my grids are empty.

I think the problem is because the customerID in the Northwind database is a string and my ClientID is an integer. So I might have altered the code incorrectly.

My view has another grid which is independent of the selection grids which are on the bottom of the page. This grid is working without any problems.   

I was wondering if someone could please have a look at my code and let me know what I have missed?

My View and Controller code is attached below. 

Cheers
Staci

6 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 31 Jul 2012, 08:06 AM
Hi Staci,

Usually when something goes wrong there are JavaScript errors in the console which are really helpful to trace the problem. Could you please check the console and tell us if there are any when you load the page?

Kind regards,
Petur Subev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
Staci
Top achievements
Rank 1
answered on 01 Aug 2012, 04:07 PM
Hi Petur,

Thanks for the reply.Do you mean looking at the console within the browser? If so then I have looked in the console within the Developer Tools in Chrome and the details it displays is:

  1. Uncaught TypeError: undefined is not a function
 
The Controller code has been changed slightly from my original post to:

public ActionResult SelectionClientSide()
        {
            ViewData["tbl_ClientDetails"] = GetClients();
            ViewData["tbl_Campaigns"] = GetCampaignsForClient(1);
            ViewData["id"] = 1;
            return View();
        }
 
        [GridAction]
        public ActionResult _SelectionClientSide_Campaigns(int? clientID)
        {
            clientID = clientID ?? 1;
 
            return View(new GridModel<tbl_Campaign>
            {
                Data = GetCampaignsForClient(clientID)
            });
        }
 
        [GridAction]
        public ActionResult _SelectionClientSide_Clients()
        {
            return View(new GridModel<tbl_ClientDetail>
            {
                Data = GetClients()
            });
        }
 
        private static IEnumerable<tbl_Campaign> GetCampaignsForClient(int? clientID)
        {
            FrontEndDBSQLDataContext frontend = new FrontEndDBSQLDataContext();
 
            return from campaign in frontend.tbl_Campaigns
                   where campaign.ClientID == clientID
                   select campaign;
        }
 
        private static IQueryable<tbl_ClientDetail> GetClients()
        {
            FrontEndDBSQLDataContext frontend = new FrontEndDBSQLDataContext();
            return frontend.tbl_ClientDetails;
        }


Cheers,
Staci
0
Pedro
Top achievements
Rank 2
answered on 01 Aug 2012, 06:14 PM
try parsing your var clientID to int

var clientID = parseInt(e.row.cells[0].innerHTML);



0
Staci
Top achievements
Rank 1
answered on 01 Aug 2012, 07:32 PM
Thanks Pedro-Martir,

I tried your code but it made no difference. My grids still say No records to display.

Is anyone able to give me some example code where the two grids are related by an id which is an integer instead of a string?

Cheers
0
Petur Subev
Telerik team
answered on 06 Aug 2012, 11:07 AM
Hello Staci,

It seems that there is an error being thrown in the server while processing your request to the _SelectionClientSide_Clients action. 
You could use the debugger (in visual studio hit F5) to trace down the problem.

Kind regards,
Petur Subev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
Staci
Top achievements
Rank 1
answered on 06 Aug 2012, 09:40 PM
Ok thanks I will play around with that and hopefully see where I have gone wrong. Thanks again, I appreciate your time.
Tags
Grid
Asked by
Staci
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Staci
Top achievements
Rank 1
Pedro
Top achievements
Rank 2
Share this question
or