skip to main | skip to sidebar

asp tech blog

Wednesday, July 20, 2005

access datasource in Itembound (datagrid/repeater)

in the OnItemDataBound event handler, sometimes you want to access the datasource of a control. whether the datasource is a object, or just a field of a dataset, you can always access it using following code:

DataRowView drv = (DataRowView)e.Item.DataItem;
//then access the specific field
string str = drv["fieldname"].ToString();
Posted by GD_V3 at 7:08 AM

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Link

  • Avinash's blog

Blog Archive

  • ►  2010 (4)
    • ►  November (1)
    • ►  October (1)
    • ►  August (1)
    • ►  February (1)
  • ►  2009 (6)
    • ►  November (2)
    • ►  May (2)
    • ►  April (2)
  • ►  2008 (3)
    • ►  October (1)
    • ►  April (1)
    • ►  January (1)
  • ►  2007 (10)
    • ►  December (1)
    • ►  November (1)
    • ►  October (2)
    • ►  August (5)
    • ►  July (1)
  • ►  2006 (11)
    • ►  November (1)
    • ►  October (1)
    • ►  May (4)
    • ►  April (2)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ▼  2005 (19)
    • ►  December (1)
    • ►  November (1)
    • ►  September (4)
    • ►  August (2)
    • ▼  July (3)
      • don't forget ( and ) in sql query if using both AN...
      • access datasource in Itembound (datagrid/repeater)
      • time to use Server.UrlEncode()
    • ►  April (1)
    • ►  March (1)
    • ►  February (2)
    • ►  January (4)
  • ►  2004 (15)
    • ►  December (8)
    • ►  November (7)

About Me

GD_V3
View my complete profile