Telerik Forums
UI for ASP.NET MVC Forum
3 answers
830 views

Hi,

How can I achieve calling a custom javascript post call (jQuery) when a user enters the Enter key ? (actually independent of which field has the focus at that moment).
Just like with a classic button submit button, but instead calling a custom js function.

Martin

Neli
Telerik team
 answered on 22 Apr 2021
1 answer
385 views

Hi,

I get a error message 'The field StartDate must be a date.' when I try to set the DatePicker dateformat, like this:

It seems something goes wrong by validating the date value, because of the format.

My code snippet:

   items.Add()
                            .Field(propInfo.Name)
                            .Label(propInfo.Label)
                            .Editor(e =>
                            {
                                e.DatePicker().Format("dd-MM-yyyy");
                            });

How can I solve this easily, on the server side (preferably not jQuery / javascript fix).

Martin
Telerik team
 answered on 21 Apr 2021
5 answers
765 views

Hi,

How can I get a vertical scrollbar in the Form component ?
I mean, the form area excl. the buttons.
I'd prefer to achieve this without having to add a css style on the page, but instead achieve this with a simple piece of (serverside) code.

In html/css I can see the following structure

  - html form
    - div formlayout
      - fieldset
      - fieldset

I would like to have a vertical scrollbar on the div formlayout I guess. Buttons shouldnt scroll, but stay visible.
In my scenario I have only 1 column of fields, but should work for any amount of columns in layout.

 

Martin

 

Stoyan
Telerik team
 answered on 21 Apr 2021
1 answer
181 views

Hi,

How can I get a textbox in the form fields with 0 decimals ?

There are always 2 decimals now.

Is teher a simple way to do it ? Preferably serverside.

 

Martin

 

Martin
Telerik team
 answered on 20 Apr 2021
1 answer
1.0K+ views

Hi,

I am creating my own MVC Helper to wrap the Form component (serverside).

Inside that helper, I do something like this to create a custom html input element event:

StringBuilder sb = new StringBuilder();
string strSaveCall = $"SaveDetailItem(null, '{_formName}', '{_saveActionUrl}', null, null);"; // '/Home/Save'
string onkeyDownEvt = _htmlHelper.Raw("if (event.keyCode == 13) { " + strSaveCall + " }").ToHtmlString();

This renders the following html:

<input type="text" id="LastName" name="LastName" ...
onkeydown="if (event.keyCode == 13) { SaveDetailItem(null, &amp;#39;myForm&amp;#39;, &amp;#39;/Home/Save&amp;#39;, null, null); }" ....">

But I would like to see it rendered without the escaped characaters, like:
if (event.keyCode == 13) { SaveDetailItem(null, 'myForm', '/Home/Save', null, null); }"

How can I achieve this ?

Martin

 

Neli
Telerik team
 answered on 19 Mar 2021
1 answer
467 views

How to render a textarea in the Form? I have the below code, it did increase the height of the textbox, but does not behave like textarea.

 

items.AddGroup()
    .Label("Comments")
    .Layout("grid")
    .Grid(g => g.Cols(1).Gutter(10))
    .Items(i =>
    {
        i.Add()
             .Field(f => f.Comments)
             .Label(l => l.Text("Comments:")).InputHtmlAttributes(new { style = "height:80px;" });
    });

 

 

 

Thank  you!

Martin
Telerik team
 answered on 01 Feb 2021
1 answer
63 views

Hello,
I have a form with different text fields ,dropdown lists and a gridview with some data.
after entering the information in text fields, I have a button that allows me to validate the creation of this new element.
this button must call an action of my controller which is used to generate an excel file where I must call the template of this file from my local files and display the information entered in the fields that correspond in the excel file
I am using npoi library (c #) in back and telerik ui for asp.net mvc 

It would be much appreciated if you can help me on this.
Thanks for replying 

Aleksandar
Telerik team
 answered on 07 Dec 2020
1 answer
97 views

Hi, I recently found out about the Form widget. I like the look-and-feel so far and tried to use it customized editortemplates loaded from gideditmode.popup with template name. The HTML rendered seems to be fine. I see data-bind attribute with correct binding but grid item data is not bound to the form.

Is my approach supported?

Neli
Telerik team
 answered on 26 Nov 2020
11 answers
2.8K+ views

When using a new form to post if adding model state errors with a key value other than string.empty the kendo().form throws error on return to view:

Message "Object reference not set to an instance of an object."string

Source: "Kendo.Mvc"string

Stack trace:

"   at Kendo.Mvc.UI.Form`1.BuildItems(IList`1 items)\r\n   at Kendo.Mvc.UI.Form`1.WriteInitializationScript(TextWriter writer)\r\n   at Kendo.Mvc.UI.WidgetBase.WriteHtml(HtmlTextWriter writer)\r\n   at Kendo.Mvc.UI.Form`1.WriteHtml(HtmlTextWriter writer)\r\n   at Kendo.Mvc.UI.WidgetBase.ToHtmlString()\r\n   at Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString()\r\n   at System.Web.HttpUtility.HtmlEncode(Object value)\r\n   at System.Web.WebPages.WebPageBase.Write(Object value)\r\n   at ASP._Page_Views_User_CreateUser_cshtml.Execute() in C:\\CustomerVS2019Projects\\iCepts\\CustomerPortal\\Views\\User\\CreateUser.cshtml:line 17\r\n   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()\r\n   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()\r\n   at System.Web.WebPages.StartPage.RunPage()\r\n   at System.Web.WebPages.StartPage.ExecutePageHierarchy()\r\n   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)\r\n   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)\r\n   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)\r\n   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)\r\n   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)\r\n   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)\r\n   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)"

Dimitar
Telerik team
 answered on 11 Jun 2020
2 answers
407 views

Hi,

 

Any option to set the focus on page load to the first control of the form. A jquery function with focus() doensn't seem to work

Regards,

Bart

Bart
Top achievements
Rank 1
 answered on 28 May 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?