I am trying to create an editor template for column in a Telerik MVC Grid. After clicking edit this simple string column should show the same string value and next to it I would like to show a button or image with an onclick event.
I CAN'T DO THIS!
I have found some really simple examples. Let's forget about the button or image for now and just display the same damn string, based on instructions found in this article: http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-3-default-templates.html
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= Html.Encode(ViewData.TemplateInfo.FormattedModelValue) %>
and:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= ViewData.TemplateInfo.FormattedModelValue %>
or:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= Model %>
None of these work. In fact, when I step into this server side, ViewData.TemplateInfo.FormattedModelValue and Model don't have a value. What's going on? What is it in the grid that is preventi开发者_Python百科ng this? More complex Editor Templates like comboboxes persist the data back to the editor template.
How can I simply display the same text in an editor template with some further options like buttons that I will later change the data?
Steve
Steve, can you provide a sample of your controller code? It sounds as though it's not setting the model data correctly.
精彩评论