473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Datagrid Databind "System.FormatException: Input string was not in a correct format"

G'day all,

Thank you in advance for anyone that can help.

I have a shopping cart datagrid on my c# asp.net page.
This is the code:

-------------------------------------

<asp:datagrid id="grdShoppingCart" OnItemDataBound="ItemDB"
ShowFooter="True" AutoGenerateColumns="False" Runat="server"
BorderStyle="None" Width="788px" GridLines="None">
<ItemStyle Font-Size="X-Small" Height="50px"
BackColor="White"></ItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Names="Arial" Height="35px"
ForeColor="White" BackColor="DimGray"></HeaderStyle>

<Columns>
<asp:TemplateColumn HeaderText="Base Part#">
<ItemTemplate>
<asp:Label Runat="server" ID="Product"><%#DataBinder.Eval(Container,
"DataItem.product_nm")%></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="cart_product_unit_cost" HeaderText="Unit
Cost" DataFormatString="{0:C}"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Qty">
<ItemTemplate>
<asp:TextBox Width="90px" Runat=server
Text='<%#DataBinder.Eval(Container, "DataItem.cart_product_qty")%>'
ID="Quantity" /> </ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="cart_product_total_cost" HeaderText="Unit
Total Cost"></asp:BoundColumn>
</Columns>
</asp:datagrid>

------------------------------------- << This works

But when I try to add another column like

<asp:TemplateColumn HeaderText="Description">
<ItemTemplate>
<asp:TextBox Runat=server Text='<%#DataBinder.Eval(Container,
"DataItem.product_desc")%>' ID="Description" /> </ItemTemplate>
</asp:TemplateColumn>

it errors with a System.FormatException: Input string was not in a
correct format.
I've even tried entering a simple.

<asp:TemplateColumn HeaderText="Description">
<ItemTemplate>
<asp:TextBox Runat=server Text='This is a description'
ID="Description" /> </ItemTemplate>
</asp:TemplateColumn>

Can anyone enlighten me as to what I'm doing wrong? I guess I can rule
out any database stuff because even if I type the static description it
errors as well.

Any advice or help would really be appreciated.
Kind regards,
Brian

May 27 '06 #1
0 3101

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Punisher | last post by:
Ok I'm trying to reference a specific node in a tree. TreeNode nodeParentChannel = treeview1.Nodes; It bugs out with this error: Input string was not in a correct format Obviously 1.2 is not...
13
by: Jen | last post by:
One user of my application is experiencing an exception "input string not in correct format". But it makes no sense where it is occurring. It is occurring when a string from a textbox ("172") is...
1
by: Anjan Bhowmik | last post by:
I am getting this exception while binding data to Gridview. I have a control parameter that accepts a integer value from a TextBox. If i provide a invalid value, i get that exception. But can't...
9
muaddubby
by: muaddubby | last post by:
Hi I'm running into a scenario with a DataSet that has a schema loaded into it, tries to then load data (that matches the schema), and fails with a "Input string was not in a correct format"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.