Hi All,
I am having problems getting the values of a dropdownlist from the FIndControl function.
Here is the code I am trying to use:
currentCategoryID = Convert.ToInt32(((DropDownList)r.FindControl("DDLCategories")));
The value of the currentCategoryID in the database is an "int"
When I execute the above code I get this error message:
Unable to cast object of type 'System.Web.UI.WebControls.DropDownList' to type 'System.IConvertible'.
Using the same code I have had to retireve textbox values using this code and all is ok
currentAddress = ((TextBox)r.FindControl("txtAddress")).Text;
Could someone please point me in the right direction on how to write this code correctly