One option is to use the generic BindingList<T> class.
http://msdn2.microsoft.com/en-us/library/ms132679.aspx#Mtps_DropDownFilterText
> One option is to use the generic BindingList<T> class.
>
[quoted text clipped - 9 lines]
>
> - Show quoted text -
Well, this looked to be just what I needed, but I haven't been able to
get it to work.
In the code below I have my original generic list, myColumns, and my
BindingList, bColumns. I populate bColumns, and I confirm that I can
get a value from the 'DB_Column_Name' property.
Then I try to populate a dropdownlist box. Perhaps I may be using the
wrong syntax here.
But I also try to populate a datagrid, and get an error saying that
'DB_Column_Name' is not found. If I try change the grid to
AutoGenerateColumns="True", it still does not work.
List<MasterColumnRecord> myColumns = wcc.Columns;
BindingList<MasterColumnRecord> bColumns = new
BindingList<MasterColumnRecord>();
foreach (MasterColumnRecord mcr in myColumns)
{
bColumns.Add(mcr);
}
string test = bColumns[0].DB_Column_Name;
SortList.DataSource = bColumns;
SortList.DataMember = "DB_Column_Name";
SortList.DataBind();
DataGrid1.DataSource = bColumns;
DataGrid1.DataBind();
cowznofsky - 12 Jul 2007 21:34 GMT
> > One option is to use the generic BindingList<T> class.
>
[quoted text clipped - 41 lines]
> DataGrid1.DataSource = bColumns;
> DataGrid1.DataBind();
Ok, I think I see part of my problem. "DB_Column_Name" was a public
varable in the class. When I make it a property, the datagrid bind
works.