I have a class Cust_Result that accepts an integer parameter.
So on my main page when it loads I bind a formview to display the data that I retrieved. Now I would like to extract the value of my “id” label and assign it to a variable which I can than pass to my Cust_Result class but I keep receiving this error
“Unable to cast object of type ‘System.Web.UI.WebControls.Label’ to
type ‘System.IConvertible’.”
I am assuming it is because I am trying to send a string value to a parameter that is wanting an integer value but I am unsure on how to do the conversion.
My code
int cust;
cust = (Convert.ToInt32(FormView1.Row.FindControl("ID")));
You need a string to convert and that’s the
Label.Textproperty (not just the Label).I’ll split it into 2 steps: