Specified cast is not valid error on datagrid

N

.Net Sports

IN a datagrid code behind, I'm getting a "Specified cast is not valid"
error


price = (Decimal)(rowData["totalamount"]);

which was initialized as:

Decimal price;

????
..netsports
 
G

Grant Merwitz

First of all, should it not be (decimal) instead of (Decimal).

Also, Try step through the CodeBehind and see what value
rowData["totalamount"].ToString() is
It may very well be null or blank, and then unable to convert.

you can also try (double)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top