Author: mrgruby | Posted on: 6/6/2009 12:18:21 PM | Views : 541

I'm using a ListView to display search results. The details of the search is pulled from a custom object which is bound to the ListView through an ObjectDataSource.
I need to change some UI settings depending on some property values, so I'm using the OnItemDataBound event to access the object in code behind.
In this code, I need to set the visibility of a Panel, depending on the value of the object's ProfileType property.
int _profileType = int.Parse(Convert.ToString(_profil.ProfileType)); if (_profileType == 2) { Panel _respanel = (Panel)e.Item.FindControl("ResPanel"); _respanel.Visible = true; }When I run this code, I get this error:

System.FormatException: Input string was not in a corr ...

Go to the complete details ...