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

Discussion in 'ASP .Net Web Controls' started by rockdale.green@gmail.com, Jun 7, 2006.

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

    DataGrid OnItemBound find control

    trinitypete, Aug 1, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,018
    trinitypete
    Aug 1, 2003
  3. MS
    Replies:
    0
    Views:
    3,417
  4. Henri
    Replies:
    0
    Views:
    692
    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:
    449
    =?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:
    982
    John Horst
    Aug 29, 2005
  7. rockdale
    Replies:
    0
    Views:
    628
    rockdale
    Jun 7, 2006
  8. Phil Streiff
    Replies:
    3
    Views:
    1,056
    Teemu Keiski
    Apr 25, 2004
Loading...