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

RadNumericTextBox On Popup Usercontrol Edit Form

2 Answers 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nyron
Top achievements
Rank 1
Nyron asked on 17 Dec 2008, 10:22 PM
Hey Guys,
  I am using a custom user control to Edit/Insert records, but when I click the Add New record button I am getting an error when the RadNumericTextBox is about to be bind, I think its because the '<%# DataBinder.Eval( Container, "DataItem.CommissionRate") %>' is null as I am adding a new record, I have been trying to find away around this with no results.

Here is the html for the user control:
<telerik:RadNumericTextBox ID="TxCommissionRate" runat="server" EmptyMessage="Enter Comission Rate" MinValue="1.00"   MaxValue="99999.99" Skin="Forest" Width="94px" Value='<%# DataBinder.Eval( Container, "DataItem.CommissionRate") %>'  > </telerik:RadNumericTextBox> 


As I said I get no error if I am editing a record, but when I click the add record button I get an error saying: System.InvalidCastException was unhandled by user code
  Message="Specified cast is not valid."
  Source="App_Web_bc5zubk-"
  StackTrace:
       at ASP.BillerInfo.__DataBindingTxCommissionRate(Object sender, EventArgs e) in c:\Documents and Settings\NWilliams\My Documents\Visual Studio 2005\WebSites\WebExpress\Admin\Biller\BillerInfo.ascx:line 105
       at System.Web.UI.Control.OnDataBinding(EventArgs e)
       at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
       at System.Web.UI.Control.DataBind()
       at System.Web.UI.Control.DataBindChildren()

Any help will be greatly appreciated.
Regards,
Nyron.

2 Answers, 1 is accepted

Sort by
0
Steve Y
Top achievements
Rank 2
answered on 18 Dec 2008, 12:28 AM
Instead of:

Value='<%# DataBinder.Eval( Container, "DataItem.CommissionRate") %>',

try DbValue='<%# DataBinder.Eval( Container, "DataItem.CommissionRate") %>' .

Regards, Steve
0
Nyron
Top achievements
Rank 1
answered on 18 Dec 2008, 03:17 AM
thanks steven that did the trick!!!
Regards,
Nyron.
Tags
Grid
Asked by
Nyron
Top achievements
Rank 1
Answers by
Steve Y
Top achievements
Rank 2
Nyron
Top achievements
Rank 1
Share this question
or