Thursday, June 20, 2013

Fix to RadNumericTextBox declarative binding error "Specified cast is not valid"

 <telerik:GridTemplateColumn HeaderText="No of  Subscribers">
          <ItemTemplate>
               <%#Eval("SentToCount"%>
          </ItemTemplate>
          <EditItemTemplate>
              <telerik:RadNumericTextBox ID="rnSentCount" runat="server" MaxValue="1000000"
CausesValidation="True"   NumberFormat-DecimalDigits="0" DataType="Int32"  MinValue="1" 
DbValue='<%#Bind("SentToCount"%>'/>
          </EditItemTemplate>
          <InsertItemTemplate>
              <telerik:RadNumericTextBox ID="rnSentCount" runat="server" MaxValue="1000000"
CausesValidation="True" NumberFormat-DecimalDigits="0" DataType="Int32"  MinValue="1"
DbValue='<%#Bind("SentToCount"%>'/>
           </InsertItemTemplate>
 </telerik:GridTemplateColumn>
 
 
  <%#Bind ()%> will not work with Value property so use DbValue instead and it will
 work like a charm. Why intellisense doesnt display DbValue : good question ... to telerik :) 

No comments:

Post a Comment