cannot use DataRowView in ONItemBound event if datagrid datasource is Datareader?

Discussion in 'ASP .Net' started by rockdale, Jun 7, 2006.

  1. rockdale

    rockdale Guest

    private void dgrid_OnItemDataBound(object sender,
    System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if(e.Item.ItemType ==ListItemType.Item||e.Item.ItemType
    ==ListItemType.AlternatingItem)
    DataRowView drv = (DataRowView)e.Item.DataItem;


    it caught error.

    but if I change the datasource to DataTable then it is ok.

    Is it true we cannot use DataRowView in ONItemBound event if datagrid
    datasource is Datareader?

    thanks
    -Rockdale
    rockdale, Jun 7, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jake S
    Replies:
    2
    Views:
    1,684
    KathyB
    Jul 6, 2003
  2. trinitypete

    DataGrid OnItemBound find control

    trinitypete, Aug 1, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    923
    trinitypete
    Aug 1, 2003
  3. MS
    Replies:
    0
    Views:
    3,207
  4. Henri
    Replies:
    0
    Views:
    586
    Henri
    Aug 3, 2004
  5. Replies:
    0
    Views:
    152
Loading...

Share This Page