protected void Page_Load(object sender, EventArgs e) { int?id = this.QueryString <int?>("id"); contact = DbUtil.Db.Contacts.SingleOrDefault(c => c.ContactId == id); if (contact == null) { Response.EndShowMessage("no contact", "/", "home"); } if (!Page.IsPostBack) { GridPager.SetPageSize(ContacteeGrid); GridPager.SetPageSize(ContactorGrid); } if (!Page.IsPostBack && this.QueryString <int?>("edit").HasValue) { EditUpdateButton1.Editing = true; } EditUpdateButton1.Enabled = CanEdit(); DeleteButton.Enabled = CanEdit(); EditUpdateButton1.DataBind(); task = contact.TasksCompleted.FirstOrDefault(); TaskRow.Visible = task != null; if (TaskRow.Visible) { TaskLink.Text = task.Description; TaskLink.NavigateUrl = "~/Task/List/{0}".Fmt(task.Id); } CommentsSection.Visible = ctrl.CanViewComments((int)id); }
protected void EditUpdateButton1_Click(object sender, EventArgs e) { if (EditUpdateButton1.Updating) { DbUtil.Db.SubmitChanges(); EditUpdateButton1.DataBind(); } }