Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 binding controls?

Author  Topic 

jhermiz

3564 Posts

Posted - 2004-09-15 : 11:24:54
In the past in regular windows applications I dont bind controls.
What about on the web? Is there a way or should I load data into a combo box dynamically ? Or should I bind the data?

My second question is...
I have the following:

Clients
---------
ClientID (PK)
Client

With rows like this:

1 Auburn Hills
2 Gilman
3 Blah

Then I have a profiles table that stores the ClientID

Profiles
---------
ProfileID
Profile
ClientID

Ok so if I load this combo box I want to load both (I guess) the Client name and the ID. The name I want to display in the combo box
but the ClientID I want to store in the Profiles table. Is there a way to

1) Load the combo box with both values like a columns property but just show the Client name and not the id ?
2) Reference the ClientID when doing my INSERT statement into the profiles table.

If this is confusing please let me know :)

Thanks again,
Jon


Jon
www.web-impulse.com

Can you dig it: http://www.thecenturoncompany.com/jhermiz/blog/

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-09-15 : 11:53:27
Dunno about the web combo, but the winform combo has DisplayMember and ValueMember, and SelectedValue when you want to acces the value (ClientID).
Maybe it's different in Web ?

rockmoose
/* Chaos is the nature of things...Order is a lesser state of chaos */
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-09-15 : 11:55:15
quote:
Originally posted by rockmoose

Dunno about the web combo, but the winform combo has DisplayMember and ValueMember, and SelectedValue when you want to acces the value (ClientID).
Maybe it's different in Web ?

rockmoose
/* Chaos is the nature of things...Order is a lesser state of chaos */



winform?

This is not a windows applications, its a web based application in asp.net. Thanks for the note but I know most regular apps have this, but what I am looking for mainly is to do this on the web. I'm certain possible, just not sure of the syntax?


Jon
www.web-impulse.com

Can you dig it: http://www.thecenturoncompany.com/jhermiz/blog/
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-15 : 11:58:49
ddl.DataSource = DataTable.DefaultView;
ddl.DataTextField = "Client";
ddl.DataValueField = "ClientId";
ddl.DataBind();

string sql = "select * from Client where ClientId = " + ddl.SelectedValue

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -