Thanks for your reply Doug.  Here's the ItemDataBound event code in 
full, which I modified from the code I got in MSDN. If you notice, m 
using both a Label and an Image control. The Label works fine, but 
the Image control cant seem to be found.  Is it because the Label is 
a Webform control while the Image is an HTML control?

Private Sub dlistSkeds_ItemDataBound(ByVal sender As Object, ByVal e 
As System.Web.UI.WebControls.DataListItemEventArgs) Handles 
dlistSkeds.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or _
                     e.Item.ItemType = ListItemType.AlternatingItem 
Then

            ' Retrieve the Label control in the current DataListItem.
            Dim LOC As Label = CType(e.Item.FindControl("lblOC"), 
Label)

            If Not ds.Tables(0).Rows(e.Item.ItemIndex).IsNull(0) Then
                LOC.Text = ds.Tables(0).Rows(e.Item.ItemIndex).Item
("load_optn_c")
            Else
                LOC.Text = ""
            End If

            Dim ONO As Label = CType(e.Item.FindControl("lblOB"), 
Label)
                        ONO.Text = ds.Tables(0).Rows
(e.Item.ItemIndex).Item("ord_b")
        End If
End Sub

Hope u can suggest something to make this work. 

Jeff :)

--- In [EMAIL PROTECTED], "Doug Wilson" 
<[EMAIL PROTECTED]> wrote:
> Hi Jeff
> 
>  
> 
> Without seeing your entire onItemDataBound  method I can't really 
point out
> your problem. But, the most common cause of the error message 
you're getting
> in your method is that you're casting from a control that isn't 
there. Now I
> know you'll tell me it is there - so here are possible reasons why:
> 
>  
> 
> 1.    You're not checking what row type it is.
> 
> 2.    Your control is in a template column
> 
> Doug Wilson | Lead Applications Developer | iX Webhouse
> 
> 




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/saFolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to