This question is locked. New answers and comments are not allowed.
I just installed the Telerik extensions for MVC and I'm trying to get a simple Editor set up that will hold a Biography.
This doesn't work... Throws the following:
But without any other changes, this does work...
What would cause this?
This doesn't work... Throws the following:
Object reference not set to an instance of an object.
<%: Html.LabelFor(model => model.BioText) %>
<%: Html.Telerik().EditorFor(model => model.BioText) %>
<%: Html.ValidationMessageFor(model => model.BioText) %>
But without any other changes, this does work...
<%: Html.LabelFor(model => model.BioText) %>
<%: Html.TextAreaFor(model => model.BioText) %>
<%: Html.ValidationMessageFor(model => model.BioText) %>
What would cause this?
5 Answers, 1 is accepted
0
Justin
Top achievements
Rank 1
answered on 29 Oct 2010, 10:56 PM
Does EditorFor() only work when you are passing existing data? This editor is on a 'Create' page.
0
Accepted
Hi Justin,
Thank you for your feedback. This is a bug and it will be fixed with the next release in the middle of November.
I have update your Telerik points.
The workaround for this issue is:
1. Replace EditorFor method in ViewComponentFactory with this method:
2. Rebuild the source project. Make sure the build configuration is set to Release MVC2 NET35 if you are using ASP.NET MVC 2.
Best wishes,
Hristo Germanov
the Telerik team
Thank you for your feedback. This is a bug and it will be fixed with the next release in the middle of November.
I have update your Telerik points.
The workaround for this issue is:
1. Replace EditorFor method in ViewComponentFactory with this method:
public virtual EditorBuilder EditorFor(Expression<
Func
<TModel, string>> expression)
{
Guard.IsNotNull(expression, "expression");
return Editor()
.Name(GetName(expression))
.Value((string)ModelMetadata.FromLambdaExpression(expression, HtmlHelper.ViewData).Model);
}
Best wishes,
Hristo Germanov
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
Justin
Top achievements
Rank 1
answered on 01 Nov 2010, 07:08 PM
Alright, thanks a lot! I will make that fix.
I was able to work around it by simply naming the editor:
I was able to work around it by simply naming the editor:
<% Html.Telerik().Editor()Name("BioText").Value(()=>
{
%>
<
strong
>Enter Biography Here</
strong
>
<%
}).Render();
%>
0
Mohammad
Top achievements
Rank 1
answered on 02 Nov 2010, 10:57 AM
Hi Hristo
I replaced EditorFor method in ViewComponentFactory with the mothed you have given and built the project, as well copyed the Telerik.Web.Mvc\bin\Debug MVC2 NET35\Telerik.Web.Mvc.dll file to my project but still getting the error "This property cannot be set to a null value"
but I am trying to get the editor and apply it to this design
http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx
<% for (int i = 0; i < 3; i++) { %>
<%: Html.TextBoxFor(m => m[i].Title) %> //works fine
<%: Html.Telerik().EditorFor(m => m[i].Author) %> set the Author to null
<%: Html.TextBoxFor(m => m[i].DatePublished) %> //works fine
<% } %>
I replaced EditorFor method in ViewComponentFactory with the mothed you have given and built the project, as well copyed the Telerik.Web.Mvc\bin\Debug MVC2 NET35\Telerik.Web.Mvc.dll file to my project but still getting the error "This property cannot be set to a null value"
but I am trying to get the editor and apply it to this design
http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx
<% for (int i = 0; i < 3; i++) { %>
<%: Html.TextBoxFor(m => m[i].Title) %> //works fine
<%: Html.Telerik().EditorFor(m => m[i].Author) %> set the Author to null
<%: Html.TextBoxFor(m => m[i].DatePublished) %> //works fine
<% } %>
0
Avdut
Top achievements
Rank 1
answered on 02 Nov 2010, 05:43 PM
<% Html.Telerik().Editor()Name("BioText").Value(()=>
{
%>
how to pass data dynamically here
<%
}).Render();
%>
I am passing the data in <%= HttpUtility.HtmlEncode(ViewData["Description"].ToString())%> but it is not showing Properly
Its showing as follow
Old Style Cubs LED Neon 09 Version&nbsp;<BR>
<BR>
<P style="MARGIN: 0in 0in 10pt"><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Arial','sans-serif'; COLOR: blue; FONT-SIZE: 8.5pt">**Due to the shipment requirements of this product, it will not ship via UPS or FedEx and will be sent via Truck-line.&nbsp;&nbsp;Your online shipping estimate may not reflect the correct amount for this product, however you will be billed the actual shipping costs.&nbsp; Other items in your order may ship together to save/expedite shipping.**</SPAN></P>
Please order by Individual Pieces.
But if I paste the above in value of editor its shows properly
what is the problem ...............please put some light on this issue