This question is locked. New answers and comments are not allowed.
Hi,
I noticed that my View was getting too complicated and I created my own html helper where I am using Telerik TreeView. Everything works like earlier, but I have problems understanding how Content works. Earlier I had:
and I was able to have visible data and also those hidden fields. I converted this to following helper:
My problem is that I always get the first line which is the ParameterHelper.GetFamilyIndicator... How can I get same results like in the original implementation?
Another question.. Even if I return string.Empty from my helper still TreeView is rendered. Is Render method responsible for that. What kind of magic have you used? :)
-Tatu
I noticed that my View was getting too complicated and I created my own html helper where I am using Telerik TreeView. Everything works like earlier, but I have problems understanding how Content works. Earlier I had:
| <% |
| Html.Telerik().Grid<AttributeRow>() |
| .Name("Attributes") |
| .BindTo(Model.Rows) |
| .Columns(columns => |
| { |
| columns.Add(o => { %> |
| <%= ParameterHelper.GetFamilyIndicator(o.IsFromFamily) %> |
| <%= Html.Hidden("AttributeId", o.AttributeId.ToString(), AttributeGridHelper.OtherColumnsHtmlAttributes(o.IsFromFamily, o.AttributeScope))%> |
| <%= Html.Hidden("AttributeName", o.Name, AttributeGridHelper.OtherColumnsHtmlAttributes(o.IsFromFamily, o.AttributeScope))%> |
| <%= Html.Hidden("AttributeValueId", o.AttributeValueId.ToString(), AttributeGridHelper.OtherColumnsHtmlAttributes(o.IsFromFamily, o.AttributeScope))%> |
| <%= Html.Hidden("AttributeTypeId", (int)o.AttributeTypeId, AttributeGridHelper.OtherColumnsHtmlAttributes(o.IsFromFamily, o.AttributeScope))%> |
| <% }).HtmlAttributes(new {style = "width:1px;"}); |
| columns.Add(o => o.Name).Title("Name"); |
and I was able to have visible data and also those hidden fields. I converted this to following helper:
| public static MvcHtmlString AttributeEditor<TModel>(this HtmlHelper<TModel> htmlHelper, ParameterCreateViewModel model, string url) |
| { |
| string tmp = string.Empty; |
| htmlHelper.Telerik().Grid<AttributeRow>() |
| .Name("Attributes") |
| .BindTo(model.Rows) |
| .Columns(columns => |
| { |
| columns.Add(o => { |
| ParameterHelper.GetFamilyIndicator(o.IsFromFamily); |
| htmlHelper.Hidden("AttributeId", o.AttributeId.ToString(), AttributeGridHelper.OtherColumnsHtmlAttributes(o.IsFromFamily, o.AttributeScope)).ToString(); |
| htmlHelper.Hidden("AttributeName", o.Name, AttributeGridHelper.OtherColumnsHtmlAttributes(o.IsFromFamily, o.AttributeScope)).ToString(); |
| htmlHelper.Hidden("AttributeValueId", o.AttributeValueId.ToString(), AttributeGridHelper.OtherColumnsHtmlAttributes(o.IsFromFamily, o.AttributeScope)).ToString(); |
| htmlHelper.Hidden("AttributeTypeId", (int)o.AttributeTypeId, AttributeGridHelper.OtherColumnsHtmlAttributes(o.IsFromFamily, o.AttributeScope)).ToString(); |
| }).HtmlAttributes(new {style = "width:1px;"}); |
| columns.Add(o => o.Name).Title("Name"); |
My problem is that I always get the first line which is the ParameterHelper.GetFamilyIndicator... How can I get same results like in the original implementation?
Another question.. Even if I return string.Empty from my helper still TreeView is rendered. Is Render method responsible for that. What kind of magic have you used? :)
-Tatu