We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridListControl as CellType

Thread ID:

Created:

Updated:

Platform:

Replies:

51764 Nov 14,2006 03:12 AM UTC Nov 14,2006 08:12 PM UTC Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 14, 2006 03:12 AM UTC

if a have an string array but i want to use the GridListControl as a dropdown instead of using a choicelist how do i specify this.

what do i put for:

DataSource
DisplayMember
ValueMember

thks,
ak

Administrator [Syncfusion]
Replied On November 14, 2006 11:04 AM UTC

Hi Adam,

You can convert the string array into datatable and load the datatable to the gridlistcontrol celltype. Here is a code snippet.

//QueryCellInfo event
e.Style.CellType="GridListControl";
e.Style.DataSource = ct; ///ct is coverted from string[] to Datatable.
e.Style.DisplayMember = "ChoiceListColumn";
e.Style.ValueMember = "ChoiceListColumn";

private DataTable ConvertToTable(string[] cString)
{
DataTable dTable = new DataTable("StringArray");
dTable.Columns.Add("ChoiceListColumn");
foreach(string sValue in cString)
{
DataRow dr = dTable.NewRow();
dr[0] = sValue;
dTable.Rows.Add(dr);
}
return dTable;
}

Sample : http://www.syncfusion.com/Support/user/uploads/DropDownScListControl_b388dc61.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 14, 2006 08:12 PM UTC

thats what i am doing and (and it works) but i thought there might be an more elegant solution.

thks,
ak

>Hi Adam,

You can convert the string array into datatable and load the datatable to the gridlistcontrol celltype. Here is a code snippet.

//QueryCellInfo event
e.Style.CellType="GridListControl";
e.Style.DataSource = ct; ///ct is coverted from string[] to Datatable.
e.Style.DisplayMember = "ChoiceListColumn";
e.Style.ValueMember = "ChoiceListColumn";

private DataTable ConvertToTable(string[] cString)
{
DataTable dTable = new DataTable("StringArray");
dTable.Columns.Add("ChoiceListColumn");
foreach(string sValue in cString)
{
DataRow dr = dTable.NewRow();
dr[0] = sValue;
dTable.Rows.Add(dr);
}
return dTable;
}

Sample : http://www.syncfusion.com/Support/user/uploads/DropDownScListControl_b388dc61.zip

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;