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. Advertisements

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,883
    KathyB
    Jul 6, 2003
  2. trinitypete

    DataGrid OnItemBound find control

    trinitypete, Aug 1, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,019
    trinitypete
    Aug 1, 2003
  3. MS
    Replies:
    0
    Views:
    3,428
  4. Henri
    Replies:
    0
    Views:
    696
    Henri
    Aug 3, 2004
  5. =?Utf-8?B?S2VpdGggSGFycmlz?=

    Cannot access current datasource row for ds bound to datagrid

    =?Utf-8?B?S2VpdGggSGFycmlz?=, Nov 8, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    455
    =?Utf-8?B?S2VpdGggSGFycmlz?=
    Nov 8, 2004
  6. .Net Sports

    Cannot use "fill" with Datareader

    .Net Sports, Aug 26, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    986
    John Horst
    Aug 29, 2005
  7. Phil Streiff
    Replies:
    3
    Views:
    1,060
    Teemu Keiski
    Apr 25, 2004
  8. Replies:
    0
    Views:
    244
Loading...