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

#Bind into maxValue and Value of RadNumericInput

3 Answers 298 Views
Input
This is a migrated thread and some comments may be shown as answers.
Hadar Kaufman
Top achievements
Rank 1
Hadar Kaufman asked on 15 Feb 2009, 04:47 PM
Hi,
I have a radnumeric input control inside a formview. I want to bind into it, using #Bind syntax, and also to dynamically set the max value using inline code.
This is the radnumericInput:
<telerik:RadNumericTextBox ID="txtUsedChannels" runat="server" Value='<%# Bind("txtUsedChannels") %>' ShowSpinButtons="true" MinValue="0" MaxValue="5" > 
            </telerik:RadNumericTextBox>  


which returns:
"Specified cast is not valid." this is what happends when i try to set the value. The binded value (i check in the debugger) is 0.

When I add an inline code:
<telerik:RadNumericTextBox ID="txtUsedChannels" runat="server" Value='12' ShowSpinButtons="true" MinValue="0" MaxValue="<%= SomeFunction(someCodeBehindArg) %>" > 
            </telerik:RadNumericTextBox>  

I get:
Cannot create an object of type 'System.Double' from its string representation '<%= Convert.ToDouble(RecordingConfigurationManager.sysConfig.GetLicensedChannels(configuration.getCaptureType())) %>' for the 'MaxValue' property.

Can you guide me how to use the control dynamically?

thanks,

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Feb 2009, 10:01 AM
Hello Hadar,

1. I recommend you use DbValue instead of Value:
<telerik:RadNumericTextBox  
    ID="txtUsedChannels"  
    runat="server"  
    DbValue='<%# Bind("txtUsedChannels") %>'  
    ShowSpinButtons="true"  
    MinValue="0"  
    MaxValue="5">              
</telerik:RadNumericTextBox>   

2. Test the following approach:
<telerik:RadNumericTextBox  
    ID="txtUsedChannels"  
    runat="server"  
    DbValue='<%# Bind("Value") %>' 
    ShowSpinButtons="true"  
    MinValue="0"  
    MaxValue='<%# Convert.ToDouble(Eval("yourValue")) %>'
</telerik:RadNumericTextBox> 

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Hadar Kaufman
Top achievements
Rank 1
answered on 16 Feb 2009, 01:28 PM
thanks Daniel, the DbValue is working, but the MaxValue is not working yet:
            <telerik:RadNumericTextBox    
    ID="txtUsedChannels"    
    runat="server"    
    DbValue='<%# Bind("txtUsedChannels") %>'   
    ShowSpinButtons="true"    
    MinValue="0"    
    MaxValue='<%# Convert.ToDouble(GetLicsensedChannels()) %>'>  
I get: The name 'GetLicsensedChannels' does not exist in the current context (its a code behind function).
if i change the # to =, I get the previous error bout convert from double.

0
Accepted
Daniel
Telerik team
answered on 16 Feb 2009, 02:32 PM
Hello Hadar,

I used Google to search about this error:
The name xxx Does Not Exist in the Current Context
the name 'functionname' does not exist in the current context

Please test the aforementioned suggestions and let us know if the error still persists.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Input
Asked by
Hadar Kaufman
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Hadar Kaufman
Top achievements
Rank 1
Share this question
or