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

Problem with PercentTextBox

4 Answers 152 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jose
Top achievements
Rank 2
Jose asked on 21 Oct 2010, 04:53 PM
Hi,

I'm trying to do something like this in a edit view:

<%: Html.Telerik().PercentTextBox(model => model.Quotation.VAT)
                     .Name("VAT")
                     .Spinners(true)
                     .MinValue(0)
                     .MaxValue(100)
%>

But the "model => model.Quotation.Title" is not working like in other mvc controls like TextBoxFor.
Also I've tried assigning the Value property with .Value(Model.Quotation.VAT) but with no luck.

Could you help me?
Thanks in advanced
Jose

4 Answers, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 1
answered on 21 Oct 2010, 05:10 PM
HI,

Maybe you know that HTML extension components in ASP.NET MVC should has "For" in the name if they accepts Func. In other words you can pass Func<> parameter only to Html.TextBoxFor extension rather then Html.TextBox.

After all this said, I think you figure out that you need to use PercentTextBoxFor() extension instead of PercentTextBox.

Regards,
Peter
0
Jose
Top achievements
Rank 2
answered on 21 Oct 2010, 05:27 PM
Hi Peter,

Thank you very much, you are right I lost the For clause.
But I'm continuing with problems. Now my code is like this:

<%: Html.Telerik().PercentTextBoxFor(model => model.Quotation.VAT)
                     .Spinners(true)
                     .MinValue(0)
                     .MaxValue(100)
%>

But this code generate the next error:

CS0266: Cannot implicitly convert type 'decimal' to 'double?'. An explicit conversion exists (are you missing a cast?)

I don't understand why, because VAT is a double in my model and not a decimal.
Any clue?
Regards
Jose
0
Jose
Top achievements
Rank 2
answered on 25 Oct 2010, 06:07 PM
Hi,

Any clue regarding my issue?
Regards
Jose
0
Georgi Krustev
Telerik team
answered on 27 Oct 2010, 10:49 AM
Hello Jose,

I have tried to reproduce the depicted issue, but to no avail. I have attached my test project which I have created in my attempt to replicate the described problem.

Regards,
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
Tags
NumericTextBox
Asked by
Jose
Top achievements
Rank 2
Answers by
Peter
Top achievements
Rank 1
Jose
Top achievements
Rank 2
Georgi Krustev
Telerik team
Share this question
or