I'm getting a "Specified cast is not valid" error that does not point
to the line with the code in error, but instead :An unhandled exception
was generated during the execution of the current web request.
Information regarding the origin and location of the exception can be
identified using the exception stack trace below.
The stack trace is just a lot of system class stuff with no real
explanation of where the error is. Wondering the best way to decipher a
stack trace in such a case.
thanks
..NetSports 4 1295
Can you post the stack trace from the exception?
Jeff Barnes
Microsoft Certified Application Developer
..Net Sports wrote: I'm getting a "Specified cast is not valid" error that does not point to the line with the code in error, but instead :An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
The stack trace is just a lot of system class stuff with no real explanation of where the error is. Wondering the best way to decipher a stack trace in such a case. thanks .NetSports
[InvalidCastException: Specified cast is not valid.]
TotalsProject.TotalsResult.dg1_ItemDataBound(Objec t sender,
DataGridItemEventArgs e)
System.Web.UI.WebControls.DataGridItemEventHandler .Invoke(Object
sender, DataGridItemEventArgs e) +0
System.Web.UI.WebControls.DataGrid.OnItemDataBound (DataGridItemEventArgs
e) System.Web.UI.WebControls.DataGrid.CreateItem(Int3 2 itemIndex, Int32
dataSourceIndex, ListItemType itemType, Boolean dataBind, Object
dataItem, DataGridColumn[] columns, TableRowCollection rows,
PagedDataSource pagedDataSource)
System.Web.UI.WebControls.DataGrid.CreateControlHi erarchy(Boolean
useDataSource)
System.Web.UI.WebControls.BaseDataList.OnDataBindi ng(EventArgs e)
System.Web.UI.WebControls.BaseDataList.DataBind()
TotalsProject.TotalsResult.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
whereas TotalsProject is project name, TotalsResult is the aspx
script/page, dg1 is the datagrid ID.
Thanks
NetSports
The stack trace indicates that the error is occurring in
dg1_ItemDataBound. Set a breakpoint in that method and step through it.
You should be able to determine where the invalid cast is occurring.
I hope this helps.
Regards,
Jeff Barnes
Microsoft Certified Application Developer
..Net Sports wrote: [InvalidCastException: Specified cast is not valid.] TotalsProject.TotalsResult.dg1_ItemDataBound(Objec t sender, DataGridItemEventArgs e) System.Web.UI.WebControls.DataGridItemEventHandler .Invoke(Object sender, DataGridItemEventArgs e) +0 System.Web.UI.WebControls.DataGrid.OnItemDataBound (DataGridItemEventArgs e) System.Web.UI.WebControls.DataGrid.CreateItem(Int3 2 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource) System.Web.UI.WebControls.DataGrid.CreateControlHi erarchy(Boolean useDataSource) System.Web.UI.WebControls.BaseDataList.OnDataBindi ng(EventArgs e) System.Web.UI.WebControls.BaseDataList.DataBind() TotalsProject.TotalsResult.Page_Load(Object sender, EventArgs e) System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain()
whereas TotalsProject is project name, TotalsResult is the aspx script/page, dg1 is the datagrid ID. Thanks NetSports
I put a breakpoint there, but I can't find where a break window for
debugger is. The only choices for Stepping is Step In and Step over,
which does nothing to show me what line the error is.
?????
NetSports This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jack MacRank |
last post by:
Hello,
I'm coding a webform application in C# (ASP.NET 1.1 SP1 with VS.NET 2003 Pro
on WinXP SP2 using IIS 5.1).
I created a seperate "data" class to house all the MySQL connection and sql...
|
by: Arjen |
last post by:
Hello,
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in...
|
by: Charles |
last post by:
I do not understand why I am getting a "Specified cast is not valid" error, since it has worked before. Something has changed and I am not really sure what it could be. I am looking for something...
|
by: VB Programmer |
last post by:
I am setting up forms authentication.
In my code I keep getting this error. Any ideas?
Error....
Server Error in '/LandOLots' Application....
|
by: Alan Z. Scharf |
last post by:
this question in datagrid group for several days with no
repsonse.
I'm hoping for an answer her because of greater activity in this group.
No cross-posting intended. Thanks....
|
by: Mike Cooper |
last post by:
Hello All!
I am getting teh above error message on the following code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim dgt As...
|
by: planet |
last post by:
Hi,
I wish I can solve this problem not having recode the sub. Here is
goes: I got this error' specified cast is not valid' at the second
line. from the code
Sub...
|
by: Gamma |
last post by:
I'm trying to inherit subclass from System.Diagnostics.Process, but
whenever I cast a "Process" object to it's subclass, I encounter an
exception "System.InvalidCastException" ("Specified cast is...
|
by: Kashiefah |
last post by:
Hi, I keep on receiving this error when I click on the edit email link from the datagrid:Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |