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

[Solved] Does the Numeric control only work on items in the Model?

0 Answers 69 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.
Greg Hendee
Top achievements
Rank 1
Greg Hendee asked on 14 May 2010, 09:05 AM
Hi,

I am trying to use the CurrencyTextBox control for a dynamically created field on the server to accomodate a one-to-many database relationship which requires drop down lists as well.  Since I couldn't get the grid to accomplish this, and the project deadline is nearing, I switched over to creating a table myself.

In the View, I have the following code:
            <table border="0">  
            <%  int blankCount = 1;  
                foreach (MPA.Models.tProducerSetupFeeType feeType in (IQueryable<MPA.Models.tProducerSetupFeeType>)ViewData["FeeTypes"])   
                {  
                   bool foundType = false;  
                   foreach (MPA.Models.tProducerSetup_Fee fee in (IQueryable<MPA.Models.tProducerSetup_Fee>)Model.SetupFees)  
                   {  
                       if (feeType.FeeTypeID == fee.FeeTypeID)  
                       { %> 
                       <tr> 
                       <td nowrap><%= Html.CheckBox("chkFeeTypeID::"+fee.SetupFeeID.ToString()+"::"+fee.FeeTypeID.ToString(),true) %> 
                            <%= Html.Label(feeType.FeeType) %></td>  
                       <td nowrap><%= Html.DropDownList("ddlPayee::"+fee.SetupFeeID.ToString(),new SelectList((IQueryable)ViewData["Payees"],"CompanyID","PayeeName",fee.CompanyID)) %></td>  
                       <td nowrap><%= Html.TextBox("curAmount::"+fee.SetupFeeID.ToString(),fee.FeeAmount.ToString("C")) %> 
                        </td> 
                       </tr>       
                     <% }  
                   }  
                   if (!foundType)  
                   {   %> 
                       <tr> 
                       <td nowrap><%= Html.CheckBox("chkFeeTypeID::"+blankCount.ToString()+"::"+feeType.FeeTypeID.ToString(),false) %> 
                            <%= Html.Label(feeType.FeeType) %></td>  
                       <td nowrap><%= Html.DropDownList("ddlPayee::"+blankCount.ToString(),new SelectList((IQueryable)ViewData["Payees"],"CompanyID","PayeeName"),"-- Select a Payee --") %></td>  
                       <td nowrap><%= Html.Telerik().CurrencyTextBox()  
                                                           .Name("curAmount::EMPTY" + blankCount.ToString())  
                                                           .MinValue(0)  
                                                           .Spinners(true)  
                                                           .EmptyMessage("--") %></td>  
                       </tr> 
                <%   
                        blankCount++;  
                       
                   }  
                }  
            %> 
            </table> 

In the generated HTML code, it appears to construct everything fine (one entry of three is shown):
<td nowrap> 
<div class="t-widget t-numerictextbox" id="curAmount::EMPTY3">  
<input class="t-input" id="curAmount::EMPTY3-input" name="curAmount::EMPTY3" value="" /> 
<class="t-link t-icon t-arrow-up" href="#" tabindex="-1" title="Increase value">Increment</a> 
<class="t-link t-icon t-arrow-down" href="#" tabindex="-1" title="Decrease value">Decrement</a> 
</div> 
</td> 
 

At the bottom of the generated HTML code, it registers the scripts and the functions for the controls:
<script type="text/javascript" src="/Scripts/2010.1.309/jquery-1.4.2.min.js"></script> 
<script type="text/javascript" src="/Scripts/MicrosoftAjax.debug.js"></script> 
<script type="text/javascript" src="/Scripts/MicrosoftMvcValidation.debug.js"></script> 
<script type="text/javascript" src="/Scripts/2010.1.309/telerik.common.min.js"></script> 
<script type="text/javascript" src="/Scripts/2010.1.309/telerik.calendar.min.js"></script> 
<script type="text/javascript" src="/Scripts/2010.1.309/telerik.datepicker.min.js"></script> 
<script type="text/javascript" src="/Scripts/2010.1.309/telerik.textbox.min.js"></script> 
<script type="text/javascript">   
//<![CDATA[
jQuery(document).ready(function(){
jQuery('#EffectiveDate').tDatePicker({format:'M/d/yyyy', selectedDate:new $.telerik.datetime(2010,04,13), minDate:new $.telerik.datetime(2010,00,01), maxDate:new $.telerik.datetime(9998,11,31)});
jQuery('#EndDate').tDatePicker({format:'M/d/yyyy', selectedDate:new $.telerik.datetime(2010,05,16), minDate:new $.telerik.datetime(2010,04,14), maxDate:new $.telerik.datetime(9998,11,31)});
jQuery('#CustomerCost').tTextBox({step:'1', minValue:'0', maxValue:'1000', symbol:'$', digits:2, groupSize:3, positive:0, negative:0, text:'--', type:'currency'});
jQuery('#curAmount::EMPTY1').tTextBox({step:'1', minValue:'0', maxValue:'1000', digits:2, groupSize:3, positive:0, negative:0, text:'--', type:'currency'});
jQuery('#curAmount::EMPTY2').tTextBox({step:'1', minValue:'0', maxValue:'1000', digits:2, groupSize:3, positive:0, negative:0, text:'--', type:'currency'});
jQuery('#curAmount::EMPTY3').tTextBox({step:'1', minValue:'0', maxValue:'1000', digits:2, groupSize:3, positive:0, negative:0, text:'--', type:'currency'});});
jQuery(window).unload(function(){
 
});
//]]> 
</script> 
 

However, the spinners do nothing, anything can be entered into the text box and no formatting is applied.  No Javascript errors are shown, so I can't figure out whether the control requires some other Model based entry in order to work.

Thanks.
Tags
NumericTextBox
Asked by
Greg Hendee
Top achievements
Rank 1
Share this question
or