0 Replies - 1140 Views - Last Post: 17 December 2013 - 10:21 PM Rate Topic: -----

#1 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1043
  • View blog
  • Posts: 4,057
  • Joined: 02-July 08

Input string was not in a correct format. Aspx

Posted 17 December 2013 - 10:21 PM

I am using EF on my ASPX page and I am using a DataGrid that is bound to an EntityDataSource. I made the EditCommandColumn for editing the data. The EnableDelete/Update/Insert are set to true. When I click on this button I get the above error. The databinding is working fine. I have another project that works perfectly and followed it's layout - just don't what else to check. Debugging does not isolate the issue any better.

<asp:DataGrid ID="dgZones" DataSourceID="edsZones"
                   runat="server" DataKeyField="ZoneId"
                   AutoGenerateColumns="False">
     <asp:TemplateColumn HeaderText="Zone">
      <ItemTemplate>
       <asp:Label ID="lbZone" runat="server" Text='<%# Eval("Description")%>' />
      </ItemTemplate>
      <EditItemTemplate>
       <asp:TextBox ID="tbEditZone" runat="server"  Text='<%# Eval("Description")%>' />
      </EditItemTemplate>
     </asp:TemplateColumn>


<asp:EntityDataSource ID="edsZones" runat="server" ConnectionString="name=TS_dbEntity" 
                          DefaultContainerName="TS_dbEntity" EntitySetName="Zones"
                          Where="it.[Id] = @Id" EnableDelete="True" 
                          EnableInsert="True" EnableUpdate="True">
     <WhereParameters >
      <asp:SessionParameter SessionField="Id" Name="Id" Type="Int32" />
     </WhereParameters>
    </asp:EntityDataSource>



The error:

[FormatException: Input string was not in a correct format.]
    System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +738
    System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +97
    System.Web.UI.WebControls.ListControl.PerformSelect() +34
    System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
    System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
    System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +29
    System.Web.UI.Control.PreRenderRecursiveInternal() +103
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Control.PreRenderRecursiveInternal() +175
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496


Not sure where to look for figuring out this error as it is so generic. Let me know what else I can tell you. Thanks for your time...

Is This A Good Question/Topic? 0
  • +

Page 1 of 1