I am trying to upgrade my site to asp.net.identity, but having problems almost every step. I have a simple drop down that just displays a list of states for the user to select from. There are several post on how to do this.
- add dropdown to form w autopostback= true
- Add new class library and delete the class1.cs from lib
- Add a new ADO.Net Entity Data model to the class library project.
- name it appropriately (statelist.edmx)
- in Wizard select > Generate from Database and select States table
- finish Wizard.
This creates the edmx file, a several other files context, diagram, etc, and lastly a state dataset that contains all of the column names. But nowhere is there a ctx.
The code for the page that has the drop down is:
try
{
if (!IsPostBack)
{
using (var ctx = new CompanyEmployeesEntities())
{
var companies = from comp in ctx.Companies
where comp.CompanyName.StartsWith("Ad")
orderby comp.CompanyName
select new { comp.CompanyID, comp.CompanyName };
DropDownList1.DataValueField = "CompanyID";
DropDownList1.DataTextField = "CompanyName";
DropDownList1.DataSource = companies;
DataBind();
}
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}Since the ctx is not there the code errors I have had the same problem with two posts.
I am using VS2015, EF6 and aspnet.identity. I think the code in the posts may be EF4?