Question
That is not a question. Rather an idea.
In all your samples and tutorials using data binding you use DataRowView datastructure.
Personally I do not like it. The reason is simple. This structure is not strongly typed – you have to use casting every time when you want to get cell value. Moreover that code is string-based. You have to provide column name to get the value. Ugly 🙂
For my personal use I am using this function private GanttDataSet.TasksRow GetTasksRowForGridNode(GridNode node)
{
if (node != null)
{
return ((GanttDataSet.TasksRow)((node.ListItemWhenDataBound() as DataRowView).Row));
}
else
{
return (null);
}
}
It casts DataRow to particula data row related to my DataSet (GanttDataSet). After that i can use stronly typed properties representing grid columns. That is nice I think 🙂
Answer
We all agree with you that is always better to go for strongly typed implementations. But then again strongly typed datasets are not used by all developers, and the good old text based dataset where you access fields by strings is understood by everyone. And that is what we need; simple samples.
I myself use the ECO framework from Borland when doing anything a bit more complex than a sample; checkout this article for a brief : http://bdn.borland.com/article/0,1410,33092,00.html