Users Pricing

forum

Home Forums conversion issue from a Label to int for an ID key – MindStick

conversion issue from a Label to int for an ID key

Anonymous User 2067 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;


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md