entity framework

2 posts, 0 answers
  1. aly
    aly avatar
    1 posts
    Member since:
    Sep 2018

    Posted 07 Oct 2018 Link to this post


    i am new in programming

    i want to fill raddropdownlist manually using entity framework (DataSource,displaymember,valuemember) whats the code for that

    also i want to know when i made update using linq how i pass raddropdownlist  value member to id table by where id=id whats the code i write i tried search in google but nothing found i need help please 

  2. Hristo
    Hristo avatar
    1522 posts

    Posted 08 Oct 2018 Link to this post

    Hi Aly,

    You can refer to the following MSDN article providing detailed information about Entity Framework and WinForms: https://docs.microsoft.com/en-us/ef/ef6/fundamentals/databinding/winforms. Assuming that you have already connected to the database you can bind RadDropDownList in a similar way: 
    public partial class RadForm1 : Telerik.WinControls.UI.RadForm
        private NORTHWNDEntities dbContext = new NORTHWNDEntities();
        public RadForm1()
            this.radDropDownList1.ValueMember = "CustomerID";
            this.radDropDownList1.DisplayMember = "ContactName";
            this.radDropDownList1.DataSource = this.dbContext.Customers.Local.ToBindingList();

    We also have a step by step tutorial with RadGridView, so please have a look at it here: https://docs.telerik.com/devtools/winforms/gridview/populating-with-data/binding-to-entityframework-using-database-first-approach. Regarding the update of the entities, it will be necessary to call the SaveChanges method of your context object: https://msdn.microsoft.com/en-us/library/system.data.entity.dbcontext.savechanges(v=vs.113).aspx.

    I hope this information is useful.

    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top