Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox data binding
Message
From
04/03/2005 10:26:24
 
 
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows NT
Database:
MS SQL Server
Miscellaneous
Thread ID:
00992721
Message ID:
00992733
Views:
19
Thanks Kevin, but my combobox is still empty. Here's my latest code I tested, but without success:
SqlConnection conn = new SqlConnection (ConfigurationSettings.AppSettings["ConnectionString"]);
DataSet dsTable = new DataSet ();
SqlDataAdapter adptTable = new SqlDataAdapter ("select * from client", conn);
adptTable.Fill (dsTable, "Client");
cboClient.DisplayMember = "Client";
cboClient.ValueMember = "PK_Client";
cboClient.DataSource = dsTable.Tables["Client"];
cboClient.DataBindings.Add ("SelectedValue", dsTable.Tables["Client"], "PK_Client");
>I think you're close...I believe you need one more line at the end, to actually bind/map a property of the combobox to the datatable.
>cboClient.DataBindings.Add("SelectedValue",dtClient, ,"PK_Client");
>This way, what's in the combo's SelectedValue (associated with ValueMember) will be mapped to PK_Client.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform