protected void btn_Save_Click(object sender, EventArgs e) { int id = WS.RequestInt("id"); DataEntities ent = new DataEntities(); Voodoo.Basement.AdGroup q = new Voodoo.Basement.AdGroup(); if (id > 0) { q = (from l in ent.AdGroup where l.ID == id select l).FirstOrDefault(); } q.Name = txt_Name.Text; q.height = txt_Height.Text.ToInt32(); q.width = txt_Width.Text.ToInt32(); if (id > 0 && q != null) { } else { //com.UserID = userid; ent.AddToAdGroup(q); } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("保存成功!", "List.aspx"); }