I always get the following error: "Input string was not in a correct format."
when I try to convert a string from a label to an integer. I am sure that there is a string in the label. This is my code
C#
protected void btnBestel_Click1(object sender, EventArgs e)
{
bestelling = new OrderBO();
bestelling.Adress = txtAdress.Text;
bestelling.Amount = Int32.Parse(lblAmount.Text);
bestelling.BookID = bookID;
}
.aspx
<table width="650">
<tr class="txtBox">
<td>
Boek
</td>
<td>
Prijs
</td>
<td>
Aantal
</td>
<td>
Korting
</td>
<td>
Totale Prijs
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblTitelBestel" runat="server" Text="" />
</td>
<td>
<asp:Label ID="lblPriceBestel" runat="server" Text="" />
</td>
<td>
<asp:TextBox ID="txtAdress" runat="server" Text="Belgium" />
</td>
<td>
<asp:Label ID="lblKorting" runat="server" Text="-10%" />
</td>
<td>
<asp:Label ID="lblAmount" runat="server" Text="20"/>
</td>
</tr>
</table>
I also tried Convert.ToInt32(lblAmount.Text);
What am I doing wrong?
Thanks, Vincent
OrderBOlook like?