DetailsView integer type conversion error?
Incorrect:
The above code will raise the follwing error message. "Unable to cast object of type 'System.Web.UI.WebControls.DataControlFieldCell' to type 'System.IConvertible'. "
The above error is raised when we forget to add ".Text" when retrieving the value of a field.
Correct:
if (Convert.ToDouble(ItemsDetailsView.Rows[3].Cells[1]) < 0) { ItemsDetailsView.Rows[3].Cells[1].CssClass = "changefont"; }
The above code will raise the follwing error message. "Unable to cast object of type 'System.Web.UI.WebControls.DataControlFieldCell' to type 'System.IConvertible'. "
The above error is raised when we forget to add ".Text" when retrieving the value of a field.
Correct:
if (Convert.ToDouble(ItemsDetailsView.Rows[3].Cells[1].Text) < 0) { ItemsDetailsView.Rows[3].Cells[1].CssClass = "changefont"; }
DetailsView Articles
- Difference between DetailsView and FormView control
- DataBinding a DetailsView control
- GridView and DetailsView Master/Detail page using SqlDataSource control
- GridView and DetailsView master detail page using ObjectDataSource control
- DropDownList and GridView Master/Detail page using ObjectDataSource control
- DetailsView databound event
- Using detailsview control datakeynames property
- How to get the datakey value in DetailsView control
- DetailsView autogeneraterows property
- DetailsView fields
- Formatting DetailsView control with style properties
- Using Boundfields in DetailsView control
- Display message using EmptyDataTemplate in the DetailsView Control
- How to access DetailsView's fields programmatically
- Bind a DetailsView control with a DropDownList control
- Using Command buttons in DetailsView control
- Using Commandfield element in a DetailsView control
- Using buttonfield in a DetailsView control
Most Viewed
Azure Q & A
Azure Platform
Grid-View
GridView CommandField example
Details-View
GridView and DetailsView Master/Detail page using SqlDataSource control
POCO
POCO overview and advantages - POCO class, Entity Framework in Enterprise Applications
Entity Framework
Query entity data model using linq to entities
Array List
Difference between arraylist and list collection
Web Services
How to create a Web service using Visual Studio.net
Form-View
FormView DataBound Event
Object Oriented Programming
Calling base class constructor in C#
Linq
Convert a sequence to a generic list using ToList()method
ERP
ERP Software Development
Project Ideas
Project ideas for students
AccountingSoftware
Accounting Software
MVC
Creating an ASP.Net MVC 3 application
.Net
Using assemblies in .net applications
ASP .Net
How to implement form validation using ASP.Net 2.0 Validation Controls