This question is locked. New answers and comments are not allowed.
Having issues getting a pretty basic drop down to work with a grid.
I have a Batch Object that has a CompanyId. In the grid I want to Display the company name associated with the Batch and be able to updated this with a drop down.
Now with jumping though many hoops (Attributes, KnownTypes, ViewModels, Display & Edit Temmplates) I have seemed to get this to work with one exception. After my update the Company field now displays [object object].
I have looked through the documentation and searched the forms but have not come across anything that has helped. The documentation only shows an example of string dropdown, no one that stores the ID. There is an example of the complex type which is what im attempting but again I all ways end up with [object object] after the grid updates.
The company names does display correctly on page load.
Any ideas, suggestions?
I have a Batch Object that has a CompanyId. In the grid I want to Display the company name associated with the Batch and be able to updated this with a drop down.
Now with jumping though many hoops (Attributes, KnownTypes, ViewModels, Display & Edit Temmplates) I have seemed to get this to work with one exception. After my update the Company field now displays [object object].
I have looked through the documentation and searched the forms but have not come across anything that has helped. The documentation only shows an example of string dropdown, no one that stores the ID. There is an example of the complex type which is what im attempting but again I all ways end up with [object object] after the grid updates.
The company names does display correctly on page load.
Any ideas, suggestions?
10 Answers, 1 is accepted
0
Accepted
Hi lmf232s,
Atanas Korchev
the Telerik team
This can appear if you are trying to edit or bound a complex object. The grid currently displays [object object] as this is what the toString() JavaScript method returns. Perhaps this is the problem. You can try using a client template to display a meaningful property of your object.
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
Nour
Top achievements
Rank 1
answered on 05 Sep 2010, 11:36 AM
i have run into the same problem
and tried to use Client Template but the column is showing empty data.
columns.Bound(m => m.Worker).ClientTemplate("<#=Worker.Name#");
any ideas ?
and tried to use Client Template but the column is showing empty data.
columns.Bound(m => m.Worker).ClientTemplate("<#=Worker.Name#");
any ideas ?
0
lmf232s
Top achievements
Rank 1
answered on 09 Sep 2010, 06:40 PM
Nour,
was finally able to get this working. I just had to restart from the beginning with a very basic example and work up to what I needed. What you need to do is create a Display Template for your object Worker. Its really just as easy as this: (This assumes you have a Name property on worker but you get the idea)
One last thing, you'll need to decorate your model with a UIHInt attribute. This needs to go on your model that has the FK reference to the Worker Object. It would look something like this :
was finally able to get this working. I just had to restart from the beginning with a very basic example and work up to what I needed. What you need to do is create a Display Template for your object Worker. Its really just as easy as this: (This assumes you have a Name property on worker but you get the idea)
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Worker>" %> <%: Model.Name%>One last thing, you'll need to decorate your model with a UIHInt attribute. This needs to go on your model that has the FK reference to the Worker Object. It would look something like this :
public partial class SomeObject{Hope that helps
[UIHint("Worker"), Core.Validation.Required]
public virtual int WorkerId { get; set; }
}
0
Nour
Top achievements
Rank 1
answered on 10 Sep 2010, 04:04 PM
thank you lmf232s, but that exactly what i did, the problem doesn't lie in filing the grid for the first time with some data, but the problem shows up when you edit a row or insert a new one, when using Ajax binding.
what i think is that json object which came from the controller, is not well defined !!!!!
and here is my question more specific:
Editing Telerik row whith ajax
i
what i think is that json object which came from the controller, is not well defined !!!!!
and here is my question more specific:
Editing Telerik row whith ajax
i
0
Nour
Top achievements
Rank 1
answered on 10 Sep 2010, 07:40 PM
Atana,
what do you suggest?
could i use some java script in the Client template ??
and if so, how can i do it ?
what do you suggest?
could i use some java script in the Client template ??
and if so, how can i do it ?
0
Sam
Top achievements
Rank 1
answered on 10 Sep 2010, 09:02 PM
Run in to same issue.
on Edit event I got null object for
on Edit event I got null object for
$(e.form).find('#name).data('tDropDownList')
- 'tDropDownList' is null.
- Display template is fine. It fills up data when render.
Any suggetion?
0
Daniel
Top achievements
Rank 1
answered on 10 Sep 2010, 09:39 PM
@Sam.
Plis try with this solution:
http://www.telerik.com/community/forums/aspnet-mvc/grid/drop-down-list-having-issues.aspx
Daniel.
Plis try with this solution:
http://www.telerik.com/community/forums/aspnet-mvc/grid/drop-down-list-having-issues.aspx
Daniel.
0
Sam
Top achievements
Rank 1
answered on 11 Sep 2010, 12:12 AM
Thanks.It worked perfectly.
0
Konrad
Top achievements
Rank 1
answered on 18 Sep 2010, 09:59 PM
Sam, or somebody ,could you send a working dll for 2010.2.825 version ?
0
Sam
Top achievements
Rank 1
answered on 20 Sep 2010, 07:42 PM
I will PM you. Please post your Email address.