This is a migrated thread and some comments may be shown as answers.

entity framework

1 Answer 25 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
aly
Top achievements
Rank 1
aly asked on 07 Oct 2018, 09:00 AM

hi,

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 

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 08 Oct 2018, 06:48 AM
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()
    {
        InitializeComponent();
  
        this.dbContext.Customers.Load();
        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.

Regards,
Hristo
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.
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
aly
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or