Hi
I want to inserd new record into my entity Table.
While binding the records to Dropdownlist, we add one new ListItem like "- Select One -".
If it is using ADO.NET Datasets, it is much simpler as below. But now i am using Entity Model.
Ex using ADO.NET:
ListItemCollection var_NewLists = new ListItemCollection();
ListItem dummyItem = new ListItem();
dummyItem.Value = "";
dummyItem.Text = "- Select One -";
var_NewLists.Add(dummyItem);
foreach (DataRow theRow in ds.Tables[0].Rows)
{
ListItem newItem = new ListItem();
newItem.Value = theRow[P_Id].ToString();
newItem.Text = theRow[Name].ToString();
var_NewLists.Add(newItem);
}
Now i want to do the same using Entity Model and i want to insert new record into this list before i bind it to the Dropdown.
Here is my Product table from Entity.
var product =
(from p in miEntity.Product
where p.Pipeline == false
orderby p.Name
select new
{
P_Id = p.P_Id,
P_Name = p.Name
}).ToList();