I am using Telerik for asp mvc and I used the Html.Telerik().NumericTextBoxFor
#(Html.Telerik().ScriptRegistrar().Globalization(true).DefaultGroup(group => group.Combined(true).Compress(true)))
#(Html.Telerik().NumericTextBoxFor(loc => loc.LatitudeValue).MinValue(0).MaxValue(90).Spinners(false).InputHtmlAttributes(new { width = "120", style = "width: 120px" }))
When the navigator is in English it works, but when I switch to French the separator became "," which is great, but when I write for example 12,45 . jQuery removes the ,45 and puts ,00
Did I miss something?
Your ScriptRegistrar should be after the numeric textbox. The globalization online example works as expected for me.
Related
We're using Kendo UI MVC 2019.2.619 in our MVC5 project.
Our TreeView is rendering like this:
We took a look at the HTML it's generating at our end
But it should look like this
(Source: https://www.telerik.com/forums/k--items)
This is how we generate our TreeView.
#(Html.Kendo().TreeView()
.Name("BroadcastTreeView")
.DataTextField("Text")
.DataSource(dataSource => dataSource
.Model(model => model
.Id("Id")
.HasChildren("HasChildren")
.Children("Items"))
.Read(read => read.Type(HttpVerbs.Post).Action("ReadTree", "Broadcast").Data("treeViewReadData"))
.Events(events => events.RequestEnd("onRequestEnd")))
.Messages(msg => msg
.Loading("Data ophalen...")
.RequestFailed("Kan data niet ophalen")
.Retry("Probeer opnieuw"))
.Events(events => events
.Change("onTreeViewChange")
.Expand("onTreeViewExpand"))
.HtmlAttributes(new { #class = "custom-border" }))
When we drag the .k-in span outside of the .k-icon span in the Chrome debugger. The layout is like it's supposed to be. We do not have any custom JavaScript that's manipulating the TreeView. Is this a known bug with version we're using? Thank you.
Have you upgraded your jQuery to 3.5 recently? It doesn't allow for some self-closing tags, like <span class="k-icon" /> which are present in Kendo's source.
See https://github.com/telerik/kendo-ui-core/issues/5735 .
You need to upgrade Kendo or downgrade jQuery .
We've searched for a couple of hours, but no luck. We made the decision to upgrade to Kendo 2020.5.513. It makes for some layout issues but it has fixed the issue with the treeview.
I have a issue and lost 3 days... I using the Globalization in Kendo UI.
I have read several times http://docs.telerik.com/kendo-ui/aspnet-mvc/globalization and apply in my web proyect.
I use ASP.NET MVC. Framework 4. Visual Studio 2010. Kendo UI 2014.2.1008
My country is Chile. I should be use es-CL for culture and es-ES for UICulture (spanish messages for pageable, filterable, etc).
I need that my whole app works as dd/MM/yyyy independent of client PC Windows culture is set.
I set the kendo.culture.es-CL.min.js as a copy of kendo.culture.es-AR.min.js, It was a copy & paste, it was the only thing I could think to do :(
I have a Partial View in header with the load of culture and others, it load first other views:
#{
var culture = System.Globalization.CultureInfo.CurrentCulture.ToString(); //se obtiene del servidor (web.config)
var cultureUI = System.Globalization.CultureInfo.CurrentUICulture.ToString(); //textos de mensajes kendo, paginaciĆ³n, filtros, etc, se obtiene del servidor (web.config)
}
<script src="#Url.Content("~/Scripts/kendo/2014.2.1008/messages/kendo.messages." + cultureUI + ".min.js")"></script>
<script>
kendo.culture("#culture");
</script>
I have a controller HomeController a Test Action:
public ActionResult Test(DateTime fechaTermino)
{
ViewBag.FechaTermino = fechaTermino;
return View();
}
Then, I have a View "Test" (after load the previus View), I set my DatePicker:
#{
var fechaTermino = (DateTime)ViewBag.FechaTermino;
}
...
#(Html.Kendo().DatePicker()
.Name("mdpTermino")
.Value(fechaTermino)
)
I set the culture in my web.config to es-CL and not works! (see picture, appear dd-MM-yyyy)
< globalization uiCulture="es-ES" culture="es-CL" / >
I change the culture to es-AR and its works!! (appear dd/MM/yyyy) why?
I have both js files in my Kendo folder in my solution.
< globalization uiCulture="es-ES" culture="es-AR" / >
I Try put format in every DatePiker how see in this example use HTML 5 /JS (I use MVC mode):
http://dojo.telerik.com/UqON
It's is very slowly, I don't like change 20 DatePikers everytime, and I put in my DatePiker:
.Format("dd/MM/yyyy")
and don't work using es-CL. It continue showing dd-MM-yyyy, ignores the format!!
Why only that es-AR works and not es-CL?
I recently upgraded my website from ASP.NET MVC3 (Razor) to MVC4 (Razor2), and in doing so found what seemed like a breaking change in the Razor view engine.
The scenario (greatly simplified) is shown below.
#model IEnumerable<string>
#{ Layout = null; }
<!DOCTYPE html>
<html>
<body>
<div>
#foreach (var x in Model)
{
#string.Format("Foo bar: {0}", x) // Errors in MVC4/Razor2
}
</div>
</body>
</html>
This works fine in MVC3/Razor, however in MVC4/Razor2 the string.Format line results in an error of:
Unexpected "string" keyword after "#" character. Once inside code, you do not need to prefix constructs like "string" with "#".
If you remove the #, the view engine then demands that you terminate the string.Format line with a semicolon. However, ReSharper then warns (rightly so):
Return value of pure method is not used.
The two fixes I've found for this are either to use <text>:
<text>#string.Format("The value {0}", x)</text>
Or a more curious approach using #:#:
#:#string.Format("The value {0}", x)
Is this a known and documented change in the Razor view engine?
Seems like a bug. It works with String:
#foreach (var x in Model)
{
#String.Format("Foo bar: {0}", x)
}
This is indeed a bug we decided not to fix, note that the syntax is incorrect as there is no transition between C# and markup in this case.
I understand that resharper shows a warning here but I believe the warning is wrong.
Here is the bug for future reference
https://aspnetwebstack.codeplex.com/workitem/458
The following code is working fine in development, as soon as i deploy in web server it said could find file directory. I need to change the .client template so its not hard coded like before. So if we deploy to the server where the Top folder name different or the hierarchy change, it still find the page.
I was thinking using #Url.Action but not sure how in this case to implement in .CLientTemplate
columns.Template(#<text>
#Html.ActionLink(#item.FirstName, "Index", "Summary", new { testId = #item.FirstName })
</text>)
.ClientTemplate("<a href='/Summary/Index/?testId =#= TestId #'>#=FirstName#</a>").Title("First Name");
Something like this should do:
.ClientTemplate("<a href='" + Url.Action("Index", "Summary", new { testId = "#=TestId#" }) + "'>#=FirstName#</a>")
I got this one working fine
columns.Bound(a => a.Id)
.Title("Action")
.Filterable(false)
.ClientTemplate(
"<a href='"
+ Url.Action("ActionName", "Controller")
+ "/#= Id #'"
+ ">View</a>"
);
I needed an extra column and a link button field for go to details page of a customer. I don't need filter option for this column and that is why I remove it using Filterable(false). Also you can give the link content and column header as above. This value "/#= Id #'" is the one I pass to the controller action method.
In case you're using server-binding (as opposed to ajax) and Razor as your view-engine, here is an example. I need a link such as /Controller/Action/Id where Id is obtained from a property of the model. Please note that #item denotes the model instance being currently processed by the grid.
columns.Template(#<text>#Html.ActionLink(AbaScore.Resources.App.Edit,"ACTION", "CONTROLLER", new { #item.Id }, null)</text>)
I've seen 87 different examples of this and none of them worked. This is what I finally did and it worked, and it's simple as heck.
columns.Bound(p => p.member_id)
.ClientTemplate("<a href='/members/details/#=member_id#'>Details</a>")
;
I want to insert a message which says Type here for example in a textbox in MVC3.
How do I do it?
Can it be done in the Model class on the field declaration?
Please suggest any way of doing?
You could use the HTML5 placeholder. Works in chrome and firefox. U can use modernizr to make it work in IE and other older browsers.
How to set up modernizr for placeholder
#Html.TextBoxFor(model => model.Name,new { placeholder = "Fill in your name" })
#Html.TextBox("Place textbox name here", "Place default value here")
#Html.TextBoxFor(Model field declaration here, new { Value = "Place default value here" }
If you want to use input mask then you may take look here jquery input mask