Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataBound GridView - accessing fields in RowBound method
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01310810
Message ID:
01310872
Vues:
9
>If it's bound to something like a datatable, code like this should work:
>
>
>if (e.Row.DataItem is DataRowView)
>{
>   DataRowView view = e.Row.DataItem as DataRowView;
>   string field = view["FieldInTable"].ToString();
>}
>
>
>Basically you cast DataItem to the correct underlying type, then reference the elements the standard way for that type.

Thanks a lot. Never would have thought I need to do this in 2 steps with casting. It worked like a charm.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform