This question is locked. New answers and comments are not allowed.
Hello,
i have an EditorTemplate Integer.ascx.
How can i prevent the string "null" for a Model which is null. The TextBox should be empty in this case.
Regards,
Timo
i have an EditorTemplate Integer.ascx.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Nullable<int>>" %> <%= Html.Telerik().IntegerTextBox() .Name( ViewData.TemplateInfo.GetFullHtmlFieldName( string.Empty ) ) .InputHtmlAttributes( new { style = "width:100%" } ) .EmptyMessage( string.Empty ) .MinValue( int.MinValue ) .MaxValue( int.MaxValue ) .Value( Model ) %>How can i prevent the string "null" for a Model which is null. The TextBox should be empty in this case.
Regards,
Timo
7 Answers, 1 is accepted
0
Hi Timo,
This behavior is not expected. Please verify that the telerik.textbox.min.js or telerik.textbox.js file is loaded on the page. For more information review this help topic and examine these online examples:
http://demos.telerik.com/aspnet-mvc/grid/editingserverside
http://demos.telerik.com/aspnet-mvc/grid/editingajax
Best wishes,
Georgi Krustev
the Telerik team
This behavior is not expected. Please verify that the telerik.textbox.min.js or telerik.textbox.js file is loaded on the page. For more information review this help topic and examine these online examples:
http://demos.telerik.com/aspnet-mvc/grid/editingserverside
http://demos.telerik.com/aspnet-mvc/grid/editingajax
Best wishes,
Georgi Krustev
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
JULIA
Top achievements
Rank 1
answered on 26 Jul 2010, 07:06 AM
Hello Georgi,
the following script is loaded.
<script type="text/javascript" src="/ProMedDoc/Scripts/2010.2.713/telerik.textbox.min.js"></script>
This is the code of the PartialView:
The EditorTemplates in your online demos are only for not nullable types.
Regards,
Timo
the following script is loaded.
<script type="text/javascript" src="/ProMedDoc/Scripts/2010.2.713/telerik.textbox.min.js"></script>
This is the code of the PartialView:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <style type="text/css"> .field-validation-error { position: absolute; display: block; } * html .field-validation-error { position: relative; } * + html .field-validation-error { position: relative; } .field-validation-error span { position: absolute; white-space: nowrap; color: red; padding: 17px 5px 3px; background: transparent url('<%= Url.Content("~/Content/Images/validation-error-message.png") %>') no-repeat 0 0; } </style> <% Html.Telerik().Grid<Promedkos.ProMedDoc.Web.UI.ViewModels.WeightViewModel>() .Name( "weightGrid" ) .DataKeys( keys => keys.Add( k => k.WeightId ) ) .DataBinding( d => d.Ajax().Select( "_Select", "Weight", new { area = "" } ) .Update( "_Update", "Weight", new { area = "" } ) .Insert( "_Update", "Weight", new { area = "" } ) .Delete( "_Delete", "Weight", new { area = "" } ) ) .ToolBar( t => t.Insert() ) .Columns( c => { c.Bound( p => p.Date ).Width( 100 ).Format( "{0:d}" ); c.Bound( p => p.Value ).Width( 100 ); c.Bound( p => p.BodyHeight ).Width( 100 ); c.Bound( p => p.BodyArea ).Width( 150 ).Sortable( false ); c.Command( commands => { commands.Edit(); commands.Delete(); } ).Width( 120 ); } ) .Sortable() .EnableCustomBinding( true ) .Pageable( p => p.Total( ViewData["total"] != null ? ( int )ViewData["total"] : 0 ) ) .ClientEvents( c => c.OnError( "onError" ) ) .Render(); %> <script type="text/javascript"> function onError(e) { if (e.textStatus == 'error') { if (e.XMLHttpRequest.status == "500") { alert("The server was unable to process your request.\n" + e.XMLHttpRequest.responseText); e.preventDefault(); } } } </script> <% Html.Telerik().ScriptRegistrar().Globalization( true ); %>The EditorTemplates in your online demos are only for not nullable types.
Regards,
Timo
0
Hello Timo,
I am still not sure where could be the problem. You can modify our editable templates to use nullable ints for example. Everything will work.
I will suggest you to send us a simple test project which reproduces the depicted issue in order to investigate it locally .
Best wishes,
Georgi Krustev
the Telerik team
I am still not sure where could be the problem. You can modify our editable templates to use nullable ints for example. Everything will work.
I will suggest you to send us a simple test project which reproduces the depicted issue in order to investigate it locally .
Best wishes,
Georgi Krustev
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
JULIA
Top achievements
Rank 1
answered on 26 Jul 2010, 12:14 PM
Hello,
i have found it! The following line is the problem:
.EmptyMessage( string.Empty )
If i replace this line with:
.EmptyMessage( " " )
everything works fine.
Will this fixed in the next release?
Regards,
Timo
0
Hello Timo,
Unfortunately I could not reproduce the aforementioned issue. Here is a short screencast which shows that everything works on my end:
http://www.screencast.com/users/ggkrustev/folders/Jing/media/0c4f06d7-e622-41ce-8a4d-87e0eedf90f9
As you can see there is no "null" message.
Best wishes,
Georgi Krustev
the Telerik team
Unfortunately I could not reproduce the aforementioned issue. Here is a short screencast which shows that everything works on my end:
http://www.screencast.com/users/ggkrustev/folders/Jing/media/0c4f06d7-e622-41ce-8a4d-87e0eedf90f9
As you can see there is no "null" message.
Best wishes,
Georgi Krustev
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
JULIA
Top achievements
Rank 1
answered on 26 Jul 2010, 01:15 PM
I will open a ticket with the sample project.
0
Paul
Top achievements
Rank 1
answered on 31 Aug 2010, 02:34 AM
Nevermind I have a different issue all together because the following code is throwing a Null reference exception ("Object not set to an instance of an object").
The model object is not null and a few lines above I am using the built in ASP.NET MVC controls like this and it works:
So I might have to submit a separate question since it seems mine is a bit different than yours.
Thanks,
-Paul
<%: Html.Telerik().NumericTextBoxFor(model => model.CardNumber) %>The model object is not null and a few lines above I am using the built in ASP.NET MVC controls like this and it works:
<%: Html.DisplayFor(model => model.CustomerId) %>So I might have to submit a separate question since it seems mine is a bit different than yours.
Thanks,
-Paul