By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,931 Members | 1,599 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,931 IT Pros & Developers. It's quick & easy.

Specified Cast Is Not Valid

P: n/a
this question in datagrid group for several days with no
I'm hoping for an answer her because of greater activity in this group.
No cross-posting intended. Thanks.

VS.NET 2003
SQLServer 2000
IIS 66.0
1. I have sever web pages with datagrids that draw info from different
respecitve SQLServer tables.

2. The datagrids have Item Templates columns for editing data.

3. The pages initially load their data into the datagrids fine, but when I
edit data, I get the 'Specified Cast IS Not Valid' error below.

4. NOTE: All these pages worked fine for Many Months for data editing, and
then this error started at the same time on all the pages with datagrids.

Other pages with just text boxes used for editing still work fine..

5. Was there anything in any automatic Windows or Net Framework update that
might have changed something?

Thanks very much for any help.

I can't figure this one out. I hadn't changed anything.


Server Error in '/' Application.

Code Section
protected void RowChanged(object sender, System.EventArgs e)
// Add changed record ID's to ChangedRecordList for SaveRecord loop
DataGridItem dgi = (DataGridItem) (((Control) sender).NamingContainer);
int recordID = int.Parse(dgi.Cells[0].Text);

// Add to list if not already there

Error Message:
Specified cast is not valid.
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 the code.

Exception Details: System.InvalidCastException: Specified cast is not valid.

Source Error:

Line 167: {
Line 168: // Add changed record ID's to ChangedRecordList for SaveRecord
Line 169: DataGridItem dgi = (DataGridItem) (((Control)
Line 170: int recordID = int.Parse(dgi.Cells[0].Text);
Line 171:
Source File: d:\inetpub\wwwroot\winfundssql\default.aspx.cs Line: 169

Stack Trace:

[InvalidCastException: Specified cast is not valid.]
NetFunds.Values.RowChanged(Object sender, EventArgs e) in
System.Web.UI.WebControls.TextBox.OnTextChanged(Ev entArgs e) +108

System.Web.UI.WebControls.TextBox.System.Web.UI.IP ostBackDataHandler.RaisePo
stDataChangedEvent() +26
System.Web.UI.Page.RaiseChangedEvents() +115
System.Web.UI.Page.ProcessRequestMain() +1081

Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.