forum

Home / DeveloperSection / Forums / conversion issue from a Label to int for an ID key

conversion issue from a Label to int for an ID key

Anonymous User 1738 22-Dec-2014

I got problem converting this car id key from a label. Here is the error I am receiving

Unable to cast object of type 'System.Web.UI.WebControls.HiddenField' to type 'System.Web.UI.WebControls.Label'.

Do you have any suggestion to avoid this error ?

Thanks

Label myCarId = (Label)item.FindControl("carId");

iCarId = Convert.ToInt32(myCarId);

Session["carId"] = iCarId;


Updated on 23-Dec-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By