This question is locked. New answers and comments are not allowed.
Andy McShane
Top achievements
Rank 1
Andy McShane
asked on 20 Apr 2010, 01:01 PM
Hi, I am trying to implement the related grid example. I have finally managed to upgrade my site to MVC 2, I am using the latest MVC 2 dll, scripts & css files (2010.1.315). Now when I load the page with the related grids on i get the following error 'onRowSelected is undefined' even though I can see the code on the page. Any ideas?
6 Answers, 1 is accepted
0
Hello Andy McShane,
We cannot help unless we see your code. I presume you have already checked the related grids example.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
We cannot help unless we see your code. I presume you have already checked the related grids example.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Andy McShane
Top achievements
Rank 1
answered on 20 Apr 2010, 01:17 PM
Yes, I have actually copied the related grids example. This is the code that I have on my page
The javascript as you can see is at the base of the page which is why I do not understand why it thinks it is undefined. Are there any additional scripts for the grid that I need to include?
| <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ServiceUserViewModel>" %> |
| <%@ Import Namespace="PPMSII.Models"%> |
| <%= Html.Telerik().Grid(Model.ServiceProviders) |
| .Name("Providers") |
| .Columns(columns => |
| { |
| columns.Bound(p => p.ServiceProviderId).Width(100).Title("ID"); |
| columns.Bound(p => p.ServiceProviderName).Width(800).Title("Provider Name"); |
| columns.Bound(p => p.ServiceProviderStatus).Width(100).Title("Is Active?"); |
| }) |
| .Pageable() |
| .Sortable() |
| .Selectable() |
| .RowAction(row => |
| { |
| rowrow.Selected = row.DataItem.ServiceProviderId.Equals(ViewData["ProviderId"]); |
| }) |
| .ClientEvents(events => events.OnRowSelected("onRowSelected")) |
| .DataBinding(dataBinding => dataBinding.Ajax().Select("Providers", "ServiceUser", new { customerId = ViewData["CustomerId"] })) |
| %> |
| <br /> |
| <%= Html.Telerik().Grid(Model.ServiceUsers) |
| .Name("ServiceUsers") |
| .ToolBar(commands => commands.Custom().Text("Create").Action("Create", "ServiceUser", new { id = Convert.ToInt32(ViewData["CustomerId"]), height = 550, width = 900, modal = "true" }).HtmlAttributes(new { @class = "thickbox" })) |
| .Columns(columns=> |
| { |
| columns.Bound(u => u.UserId).Width(100).Title("ID"); |
| columns.Bound(u => u.UserFirstName).Title("Firstname"); |
| columns.Bound(u => u.UserSurname).Title("Surname"); |
| }) |
| .Pageable() |
| .Sortable() |
| .DataBinding(dataBinding => dataBinding.Ajax().Select("ServiceUsers", "ServiceUser", new { providerId = 0 })) |
| %> |
| <script type="text/javascript"> |
| function onRowSelected(e) { |
| var usersGrid = $('#ServiceUsers').data('tGrid'); |
| providerId = e.row.cells[0].innerHTML; |
| // update ui text |
| $('#providerId').text(providerId); |
| // rebind the related grid |
| usersGrid.rebind({ |
| providerId: providerId |
| }); |
| } |
| </script> |
The javascript as you can see is at the base of the page which is why I do not understand why it thinks it is undefined. Are there any additional scripts for the grid that I need to include?
0
Hello Andy McShane,
No, there aren't any aditional scripts required. I suggest you check the output rendered by your page and see if the onRowSelected function is output. In case you cannot find out what the problem is you can provide a runnable project. We will debug it for you.
All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
No, there aren't any aditional scripts required. I suggest you check the output rendered by your page and see if the onRowSelected function is output. In case you cannot find out what the problem is you can provide a runnable project. We will debug it for you.
All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Sylwester
Top achievements
Rank 1
answered on 11 Aug 2010, 12:01 AM
How can I by ClientEvents(e => e.onRowSelected()) with Grid may passing parameter (e.g., someID) to another View ?
Thx
Thx
0
Gathindra
Top achievements
Rank 1
answered on 15 Feb 2011, 07:05 PM
Since you are doing Ajax binding specify the binding type Html.Telerik().Grid<Your type>().
0
Love
Top achievements
Rank 1
answered on 15 Feb 2011, 08:21 PM
This happened to me couple of days ago. All of a sudden my existing code stoped working while I was testing some other scripts. Non of the Client Events on Grid worked for me. I spend couple of hours trying to resolve this issue. Finally.... cleaned up all temporary files, closed VS and reopened it. Same code started working again. Give this a shot.