private void View(DataGridCommandEventArgs e) { // Collect the new values int intID = (int)this.dgErrorLogResults.DataKeys[e.Item.ItemIndex]; // Get the error entry BusinessServices.Error objError = new BusinessServices.Error(); DataTable dtbError = objError.GetError(intID, UserContext.UserData.OrgID); // Populate the values this.lblErrorLogID.Text = Server.HtmlEncode(dtbError.Rows[0]["ErrorLogID"].ToString()); this.lblCode.Text = Server.HtmlEncode(dtbError.Rows[0]["Code"].ToString()); this.lblSource.Text = Server.HtmlEncode(dtbError.Rows[0]["Source"].ToString()); this.lblModule.Text = Server.HtmlEncode(dtbError.Rows[0]["Module"].ToString()); this.lblFunction.Text = Server.HtmlEncode(dtbError.Rows[0]["Function"].ToString()); this.lblMessage.Text = Server.HtmlEncode(dtbError.Rows[0]["Message"].ToString()); this.lblStackTrace.Text = Server.HtmlEncode(dtbError.Rows[0]["StackTrace"].ToString()); this.lblErrorLevel.Text = Server.HtmlEncode(dtbError.Rows[0]["ErrorLevelDescription"].ToString()); this.lblErrorStatus.Text = Server.HtmlEncode(dtbError.Rows[0]["ErrorStatusDescription"].ToString()); this.lblResolution.Text = Server.HtmlEncode(dtbError.Rows[0]["Resolution"].ToString()); this.lblDateCreated.Text = Server.HtmlEncode(dtbError.Rows[0]["DateCreated"].ToString()); this.lblDateUpdated.Text = Server.HtmlEncode(dtbError.Rows[0]["DateUpdated"].ToString()); // Show the single entry and hide the log this.plhErrorLog.Visible = false; this.plhErrorEntry.Visible = true; }
private void BindGrid() { BusinessServices.Error objError = new BusinessServices.Error(); // Get datatable of errors DataTable dtbErrorLog = objError.GetReport(UserContext.UserData.OrgID); // Bind to the grid dgErrorLogResults.DataKeyField = "ErrorLogID"; dgErrorLogResults.DataSource = dtbErrorLog; dgErrorLogResults.DataBind(); }
private void Update(DataGridCommandEventArgs e) { // Collect the new values int intID = (int)this.dgErrorLogResults.DataKeys[e.Item.ItemIndex]; string strResolution = ((TextBox)e.Item.FindControl("txtResolution")).Text; string strErrorStatus = ((ListBox)e.Item.FindControl("lstErrorStatus")).SelectedValue; string strErrorLevel = ((ListBox)e.Item.FindControl("lstErrorLevel")).SelectedValue; BusinessServices.Error objError = new BusinessServices.Error(); // Update the error objError.Update(intID, Int32.Parse(strErrorLevel), Int32.Parse(strErrorStatus), strResolution); // Deselect the row this.dgErrorLogResults.EditItemIndex = -1; this.BindGrid(); }