Click here to Skip to main content
15,901,505 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to bind three textboxes values into one combobox ?i've 3 textboxces am inserting into DB.How to bind these three values into cimbobox every time.pls help me
Posted
Updated 16-Apr-13 19:53pm
v4
Comments
Maksud Saifullah Pulak 16-Apr-13 3:09am    
From where you want to bind the data?Like database or any other collection ??
Amarender1479 16-Apr-13 3:11am    
from database

 
Share this answer
 
Oh then it's easy.just select three expected column and then combine into one string and return as one column.then just bind the returning column as like as simple drop down list.


Sample Code:

XML
List<ListItem> users = new List<ListItem>();
foreach (SubscriptionUser su in subscriptionDetails.UserList)
{
    users.Add(new ListItem(su.FirstName + " " + su.LastName, su.EmailAddress));
}
ddlPrimaryContact.DataTextField = "Text";
ddlPrimaryContact.DataValueField = "Value";
ddlPrimaryContact.DataSource = users;
ddlPrimaryContact.DataBind();
 
Share this answer
 
Comments
Amarender1479 16-Apr-13 3:25am    
thank you Maksud Saifullah
wish this can help

datatable dt = new datatable();
dt = filldata(); // any method to fill dt

CMB.DataTextField ="Text feild";
CMB.DataValueField = "value feild ";
CMB.datasourse= dt ;
CMB.databind();
 
Share this answer
 
HI
Please use this method

Build a datatable
Add a columns
Assign the text box value as row to the datatable.
And bind the datatable value to COMBO BOX.


Rgds
Jagadesh
 
Share this answer
 
DataTable dt = null;

if (dt != null)
{
cmbPurNo.DataSource = dt;
cmbPurNo.ValueMember = "PSettingId";
cmbPurNo.DisplayMember = "PValue";
}

this methode get one textbox value only.at a time i want get 3 textboxces values
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Apr-13 10:21am    
Not an answer.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900