user85511
user85511

Reputation: 533

Conversion from string to double error

i have a project for uploading video.in that when i click the showvideo button there is a error. code-

param name="url" value='<%# "VideoHandler.ashx?FileID=" + Eval("FileID") %>'

error message ::: conversion form string="VideoHandler.ashx?FileID=" to type 'Double' is not valid

anyone knows please answer for me thank you

Upvotes: 0

Views: 939

Answers (5)

darasd
darasd

Reputation: 2997

Just add ToString() to the end of your Eval. FileId is a double, and it's seeing the + and trying to add it to a string, numerically, instead of concatenating it.

Upvotes: 0

GalacticCowboy
GalacticCowboy

Reputation: 11769

"VideoHandler.ashx?FileID=" is a string. Eval("FileID") results in a double. You have a type mismatch, so the addition overload doesn't know how to proceed. Solve it like this:

string.Format("VideoHandler.ashx?FileID={0}", Eval("FileID"))

Upvotes: 1

D. Veloper
D. Veloper

Reputation: 1517

We should see some code. Apparantly the application is trying to convert "VideoHandler.ashx?FileID=" to a Double value which cannot be done.

Upvotes: 0

rahul
rahul

Reputation: 187110

You are trying to convert a string which is not a valid double type.

I think you are trying to convert the FileID field to double. Then you can split the string and then convert only the FileID part of it.

You can get the querysting data using

Request.QuerySting["FileID"] and then convert it to double.

or use

Double.TryParse Method

Upvotes: 0

kemiller2002
kemiller2002

Reputation: 115548

Without seeing the code, it sounds like you are trying to convert a string which isn't a valid double. Are you taking the value of the query string and trying to convert it or, could you have accidentally tried to convert the page name along with the query string? Based on the short error message you gave, that is what it looks like. If you post the code which is doing the conversion, that will likely make it clearer what is going on, but that is my best guess at the moment.

Upvotes: 0

Related Questions