protected void DgLogTypeConfigInfoEditCommand(object source, GridCommandEventArgs e) { var logID = Convert.ToString(((GridDataItem)e.Item).GetDataKeyValue("ID")); ViewState["LogID"] = logID; BindDetailData(); var l = new LogController(); LogTypeConfigInfo objLogTypeConfigInfo = l.GetLogTypeConfigInfoByID(logID); chkIsActive.Checked = objLogTypeConfigInfo.LoggingIsActive; chkEmailNotificationStatus.Checked = objLogTypeConfigInfo.EmailNotificationIsActive; if (ddlLogTypeKey.Items.FindByValue(objLogTypeConfigInfo.LogTypeKey) != null) { ddlLogTypeKey.ClearSelection(); ddlLogTypeKey.Items.FindByValue(objLogTypeConfigInfo.LogTypeKey).Selected = true; } if (ddlLogTypePortalID.Items.FindByValue(objLogTypeConfigInfo.LogTypePortalID) != null) { ddlLogTypePortalID.ClearSelection(); ddlLogTypePortalID.Items.FindByValue(objLogTypeConfigInfo.LogTypePortalID).Selected = true; } if (ddlKeepMostRecent.Items.FindByValue(objLogTypeConfigInfo.KeepMostRecent) != null) { ddlKeepMostRecent.ClearSelection(); ddlKeepMostRecent.Items.FindByValue(objLogTypeConfigInfo.KeepMostRecent).Selected = true; } if (ddlThreshold.Items.FindByValue(objLogTypeConfigInfo.NotificationThreshold.ToString(CultureInfo.InvariantCulture)) != null) { ddlThreshold.ClearSelection(); ddlThreshold.Items.FindByValue(objLogTypeConfigInfo.NotificationThreshold.ToString(CultureInfo.InvariantCulture)).Selected = true; } if (ddlThresholdNotificationTime.Items.FindByValue(objLogTypeConfigInfo.NotificationThresholdTime.ToString(CultureInfo.InvariantCulture)) != null) { ddlThresholdNotificationTime.ClearSelection(); ddlThresholdNotificationTime.Items.FindByValue(objLogTypeConfigInfo.NotificationThresholdTime.ToString(CultureInfo.InvariantCulture)).Selected = true; } if (ddlThresholdNotificationTimeType.Items.FindByText(objLogTypeConfigInfo.NotificationThresholdTimeType.ToString()) != null) { ddlThresholdNotificationTimeType.ClearSelection(); ddlThresholdNotificationTimeType.Items.FindByText(objLogTypeConfigInfo.NotificationThresholdTimeType.ToString()).Selected = true; } txtMailFromAddress.Text = objLogTypeConfigInfo.MailFromAddress; txtMailToAddress.Text = objLogTypeConfigInfo.MailToAddress; DisableLoggingControls(); e.Canceled = true; //disable inline editing in grid }
protected void dgLogTypeConfigInfo_EditCommand(object source, DataGridCommandEventArgs e) { var LogID = Convert.ToString(dgLogTypeConfigInfo.DataKeys[e.Item.ItemIndex]); ViewState["LogID"] = LogID; BindDetailData(); var l = new LogController(); LogTypeConfigInfo objLogTypeConfigInfo = l.GetLogTypeConfigInfoByID(LogID); chkIsActive.Checked = objLogTypeConfigInfo.LoggingIsActive; chkEmailNotificationStatus.Checked = objLogTypeConfigInfo.EmailNotificationIsActive; if (ddlLogTypeKey.Items.FindByValue(objLogTypeConfigInfo.LogTypeKey) != null) { ddlLogTypeKey.ClearSelection(); ddlLogTypeKey.Items.FindByValue(objLogTypeConfigInfo.LogTypeKey).Selected = true; } if (ddlLogTypePortalID.Items.FindByValue(objLogTypeConfigInfo.LogTypePortalID) != null) { ddlLogTypePortalID.ClearSelection(); ddlLogTypePortalID.Items.FindByValue(objLogTypeConfigInfo.LogTypePortalID).Selected = true; } if (ddlKeepMostRecent.Items.FindByValue(objLogTypeConfigInfo.KeepMostRecent) != null) { ddlKeepMostRecent.ClearSelection(); ddlKeepMostRecent.Items.FindByValue(objLogTypeConfigInfo.KeepMostRecent).Selected = true; } if (ddlThreshold.Items.FindByValue(objLogTypeConfigInfo.NotificationThreshold.ToString()) != null) { ddlThreshold.ClearSelection(); ddlThreshold.Items.FindByValue(objLogTypeConfigInfo.NotificationThreshold.ToString()).Selected = true; } if (ddlThresholdNotificationTime.Items.FindByValue(objLogTypeConfigInfo.NotificationThresholdTime.ToString()) != null) { ddlThresholdNotificationTime.ClearSelection(); ddlThresholdNotificationTime.Items.FindByValue(objLogTypeConfigInfo.NotificationThresholdTime.ToString()).Selected = true; } if (ddlThresholdNotificationTimeType.Items.FindByText(objLogTypeConfigInfo.NotificationThresholdTimeType.ToString()) != null) { ddlThresholdNotificationTimeType.ClearSelection(); ddlThresholdNotificationTimeType.Items.FindByText(objLogTypeConfigInfo.NotificationThresholdTimeType.ToString()).Selected = true; } txtMailFromAddress.Text = objLogTypeConfigInfo.MailFromAddress; txtMailToAddress.Text = objLogTypeConfigInfo.MailToAddress; DisableLoggingControls(); }