Sometimes you need to access the underlying data object of an ObjectDataSource object. An example may be that you need to change the caption of a non-bindable label based on some field in the data. It can be done by using the OnSelected event of the ObjectDataSource. The
ObjectDataSourceStatusEventArgs parameter of that event has a property called ReturnValue which points to the data object returned by the SelectMethod of the ObjectDataSource. If the SelectMethod returns a DataSet object, look through the tables and rows of the DataSet to find the desired data.
Wednesday, October 18, 2006
Friday, October 13, 2006
Dictionaries and null keys
C# does not let you initialize a dictionary entry by simply assigning a value to a non-existant key in the dictionary. So instead of ...where "key" does not yet exist in the dictionary, it is necessary to do something like this...
mydictionary[key] = value;
if (mydictionary.ContainsKey(key))
{
mydictionary[key] += value;
//or
mydictionary[key] = value;
}
else
{
mydictionary.Add(key, value);
}
Subscribe to:
Posts (Atom)