Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi frnds

i have used this code to populate data in DATAGRID but i want to populate in Combobox.

Can anyone please help me out fast

C#
//Service File Code
[OperationContract]
       public List<comboFill> GetBranch()
       {
           using (Entities context = new Entities())
           {
               return (from c in context.BranchMasters
                       select new comboFill
                       {
                           Name=c.Name,
                       }).Take<comboFill>(10).ToList<comboFill>();
           }
       }
public class comboFill
       {
           public string Name { get; set; }
       }

//Form Code
private void Page_Loaded(object sender, RoutedEventArgs e)
{

    var client= new ServiceReference1.AlumniServiceClient();

    client.GetBranchCompleted += (s, ea) =>
        {

           // cboBranch.Items.Add(ea.Result);
            dataGrid1.AutoGenerateColumns = true;
            dataGrid1.ItemsSource = ea.Result;
        };
    client.GetBranchAsync();
}
Posted
Updated 4-Aug-11 4:51am
v2
Comments
Abhinav S 4-Aug-11 6:33am    
What exactly are you trying to do?
You need to provide so more information before someone can help you.
Member 8121187 4-Aug-11 6:43am    
hi..
actually i want to fill my combo boxes with data from database.
There are 7 combo on one of my form,n the data are coming from different tables(like there is a combo for CountryName and data coming from country master)
similarly there are other combo's and data coming from different masters.
My immediate requirement is to fill those combo's at form load with data from respective tables.
Can u help out???
Member 8121187 4-Aug-11 6:55am    
should i provide more details????

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