错误:
无法更新EntitySet'ClientFeedBack',因为它有一个DefiningQuery,
<InsertFunction>
元素中不存在<ModificationFunctionMapping>
元素以支持当前操作。
代码:
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
ProTrakEntities1 objEntity = new ProTrakEntities1();
TextBox txtTitle = DetailsView1.FindControl("txtTask") as TextBox;
RadComboBox cmbStatus = DetailsView1.FindControl("cmbStatus") as RadComboBox;
RadComboBox cmbTaskType = DetailsView1.FindControl("cmbTasktype") as RadComboBox;
RadComboBox cmbTaskPriorty = DetailsView1.FindControl("cmbPriority") as RadComboBox;
string Description = (DetailsView1.FindControl("RadEditor1") as RadEditor).Content;
ClientFeedBack objResource = new ClientFeedBack();
objResource.Title = txtTitle.Text;
objResource.Description = Description;
objResource.TaskPriorityID = Convert.ToInt32(cmbTaskPriorty.SelectedValue);
objResource.TaskTypeID = Convert.ToInt32(cmbTaskType.SelectedValue);
objEntity.AddToClientFeedBacks(objResource);
objEntity.SaveChanges();
DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind('navigateToInserted');", true);
}
我的表名是ClientFeedBack
。
答案 0 :(得分:0)
检查主键,检查表ClientFeedBack是否已定义主键。