Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2006, 05:36 PM
Registered User
 
Join Date: Feb 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error: "Specified cast not valid" on ItemDataBoun

Hi,
I'm getting a "Specified cast not valid" error on running the following code; I've noted where the error pops up. Any idea why it's happening? The code is for populating a nested repeater.

Code:
Public Sub rptQuestions_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptQuestions.ItemDataBound
        Dim lt As ListItemType = e.Item.ItemType
        If lt = ListItemType.Item OrElse lt = ListItemType.AlternatingItem Then
            Dim dv As DataRowView = CType(e.Item.DataItem, DataRowView)  <--- ERROR OCCURS HERE
            If Not dv Is Nothing Then
                Dim nestedRepeater As Repeater = CType(e.Item.FindControl("rptAnswers"), Repeater)
                If Not nestedRepeater Is Nothing Then
                    nestedRepeater.DataSource = dv.CreateChildView("Answers")
                    nestedRepeater.DataBind()
                End If
            End If
        End If
    End Sub
By the way, I'm retrieving the information from an ArrayList.

Thanks,
Jens






Similar Threads
Thread Thread Starter Forum Replies Last Post
Specified cast is not valid. ayem Visual Studio 2008 1 September 8th, 2008 09:15 PM
Specified cast is not valid heba ASP.NET 2.0 Professional 1 May 27th, 2007 08:51 PM
"Specified cast is not valid" help BaBaBooey ASP.NET 1.0 and 1.1 Basics 2 November 23rd, 2004 12:12 PM
Specified cast is not valid TheMole BOOK: ASP.NET Website Programming Problem-Design-Solution 9 November 1st, 2004 05:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.