You need to test the type of the DataGridItem first

if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
//your code

}

On Apr 1, 2005 1:35 AM, christopher andrada <[EMAIL PROTECTED]> wrote:
> 
> hi all,
> 
> i'm getting an error "Specified cast is not valid" in
> the code below.
> 
> public void OnItemDataBoundEventHandler(object sender,
> DataGridItemEventArgs e) {
> 
> // this is the line where the error occurs.
> string temp =
> ((DataRowView)e.Item.DataItem).Row.ItemArray[1].ToString();
> }
> 
> please help.
> 
> Thanks,
> 
> chris
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 


-- 
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com


 
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