Home - Forums-.NET - FlyGrid.Net (Windows Forms) - datasource for lookuplistcolumn

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

datasource for lookuplistcolumn
Link Posted: 05-Oct-2005 22:46
Hi,
ArrayList is supported as datasource I assume so what's wrong in my code:
      
m_ViewTableValue = New LookupListColumn("Table", "ViewTable")
        m_ViewTableValue.FitMode = ColumnFitMode.SmartFit
        m_ViewTableValue.DropDownStyle = DropDownStyle.DropDownList
      
        m_arr.AddRange(m_queries.GetSchemaTables())
      
        m_ViewTableValue.LookupSource = m_arr
        m_ViewTableValue.LookupBoundField = "table_name"
        m_ViewTableValue.LookupDisplayField = "table_name"
        dgDisplay.Columns.Items.Add(m_ViewTableValue)


m_arr is an arraylist and it contains correct values. But when I click on my lookuplist it is empty. What am I doing wrong?

Thanks
Link Posted: 07-Oct-2005 01:56
Please I really need help there.

The datasource of the grid is a dataset. But for one of the lookuplist column I want to set its lookupsource to an ArrayList. As mentionned above, it compiles but the list is empty. Can you help?
Link Posted: 10-Oct-2005 14:51
In your case (do not need to translate some source field values into displayed)  you should use usual DropDownListColumn.
Link Posted: 10-Oct-2005 21:02
Thank you !

EDIT
-----

Actually would it be possible to have a AddRange function that takes an array of Object as argument instead of an array of String ?
Link Posted: 11-Oct-2005 04:30
DropDownListColumn.Items provides AddRange method, but as argument you should use array of strings (string[]) .
Link Posted: 11-Oct-2005 04:32
yes I know, I was wondering if you would be kind enough to provide also a AddRange method that takes an array of Object as argument  

Thanks anyway
Link Posted: 11-Oct-2005 05:17
DropDownListColumns uses standard StringCollection class to maintain dwopdown items and doesn't provides AddRange(object[]), but you can use following code to convert object[] to string[]:
[C#]
public string[] GetStringArray(object[] items)
{
  ArrayList al = new ArrayList(items);
  return al.ToArray(typeof(string)) as string[];
}
Link Posted: 11-Oct-2005 05:23
This is what i'm doing already
  
thanks