This is a migrated thread and some comments may be shown as answers.

[Solved] TabStrip using LoadContentFrom with NumericTextBox has an error

3 Answers 71 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ricardo
Top achievements
Rank 1
Ricardo asked on 06 Mar 2013, 05:23 PM
Hello,

I'm using a TabStrip with LoadContentFrom a PartialView and inside the model from the PartialView, I have a DataType("Number"), but, when I put the name of the Number.ascx as the name of the field from my model, it doesn't bind properly.

When I use the code below, it doesn't work:
<%= Html.Telerik().NumericTextBox()
        .Name(this.ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
        .Value((double)this.Model)
        .DecimalDigits(1)
%>

But, when I do like this, it works:
<%= Html.Telerik().NumericTextBox()
        .Name("Value2")
        .Value((double)this.Model)
        .DecimalDigits(1)
%>

The attached project has this problem.

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Mar 2013, 02:51 PM
Hello Ricardo,

The value seems to be correctly populate in the provided project at least on my side. Could you check this screen cast and let me know if I am missing something? Also, please check if using NumericTextBoxFor instead resolves the problem:

Html.Telerik().NumericTextBoxFor(m=> m)      
    .DecimalDigits(1)
The name might be prefixed when it is set inside an editor template. Regards,
Daniel
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
Ricardo
Top achievements
Rank 1
answered on 11 Mar 2013, 04:43 PM
I forgot to mention that i'm not using en-US, but pt-BR.
0
Accepted
Daniel
Telerik team
answered on 12 Mar 2013, 04:39 PM
Hello Ricardo,

Thank you for clarifying. A different value is set because the value sent with the tabstrip is not using the format for the culture and the value will be populated in the input from the ModelState. In order for the correct value to be set you should either sent the value in the culture specific format or clear the ModelState:

public ActionResult TabContentView(TabContent model)
{
    ModelState.Remove("Value");
    return PartialView(model);
}
Regards,
Daniel
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
TabStrip
Asked by
Ricardo
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Ricardo
Top achievements
Rank 1
Share this question
or