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

Setting numeric textbox in edit column

3 Answers 294 Views
Grid
This is a migrated thread and some comments may be shown as answers.
wdudek
Top achievements
Rank 1
wdudek asked on 26 Jun 2008, 05:34 PM
I have the following Template column in my grid and am having problems setting the value for the edit template's numeric text box. When I click on edit I get the following error "Specified cast is not valid." If I hard code the value or use a standard text box this doesn't happen. Any thoughts?

Thanks,
Bill

                            <rad:GridTemplateColumn HeaderText="Min Value" UniqueName="MinimumValue2" > 
                                <ItemTemplate> 
                                    <asp:Label runat="server" ID="lblMinValue" Text='<%# DataBinder.Eval(Container.DataItem, "MinimumValue") %>' /> 
                                </ItemTemplate> 
                                <EditItemTemplate> 
                                    <rad:RadNumericTextBox ID="tbMinValue" runat="server"  MinValue="0" MaxValue="2147483647" Value='<%# (double)DataBinder.Eval(Container.DataItem, "MinimumValue") %>' > 
                                    </rad:RadNumericTextBox> 
                                </EditItemTemplate> 
                            </rad:GridTemplateColumn> 
 

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Jun 2008, 05:41 AM
Hi wdudek,

Try setting  the DbValue property for the RadNumericTextBox as shown below.

ASPX:
 
  <EditItemTemplate> 
    <rad:RadNumericTextBox 
     width="60px" 
       id="tbMinValue" 
       runat="server" 
                                DbValue='<%# (double)DataBinder.Eval(Container.DataItem, "MinimumValue") %>'  
   Type="Number"></rad:RadNumericTextBox> 
 </EditItemTemplate> 
                                     


Thanks
Shinu.
0
wdudek
Top achievements
Rank 1
answered on 27 Jun 2008, 01:49 PM
I still got the error when I did that, also while it did compile the DbValue property didn't show up in intellisense?
0
Sebastian
Telerik team
answered on 27 Jun 2008, 02:08 PM
Hi wdudek,

I suggest you review the following online resources which elaborate on how to bind data for our RadInput controls when residing in a data-bound control:

http://www.telerik.com/help/aspnet-ajax/input_commondatabinding.html
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Input/Examples/Common/DataGrid/DefaultCS.aspx
http://www.telerik.com/support/kb/article/b454K-eme-b454T-cbb-b454c-cbb.aspx

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
wdudek
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
wdudek
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or