Example #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         SetTemplate();
         if (IsValid)
         {
             ActiveNode.Title            = txtTitle.Text;
             ActiveNode.Culture          = ddlCultures.SelectedValue;
             ActiveNode.ShowInNavigation = chkShowInNavigation.Checked;
             ActiveNode.MetaDescription  = txtMetaDescription.Text.Trim().Length > 0
                                              ? txtMetaDescription.Text.Trim()
                                              : null;
             ActiveNode.MetaKeywords = txtMetaKeywords.Text.Trim().Length > 0
                                           ? txtMetaKeywords.Text.Trim()
                                           : null;
             if (chkLink.Checked)
             {
                 ActiveNode.LinkUrl    = txtLinkUrl.Text;
                 ActiveNode.LinkTarget =
                     (LinkTarget)Enum.Parse(typeof(LinkTarget), ddlLinkTarget.SelectedValue);
             }
             else // rabol: [#CUY-51] - Clear the link in the database
             {
                 ActiveNode.LinkUrl    = null;
                 ActiveNode.LinkTarget = LinkTarget.Self;
             }
             ActiveNode.Validate();
             SetShortDescription();
             SetRoles();
             SaveNode();
             ShowMessage("Nút đã được lưu.");
         }
     }
     catch (Exception ex)
     {
         string msg = ex.Message;
         if (ex.InnerException != null)
         {
             msg += ", " + ex.InnerException.Message;
         }
         ShowError(msg);
         log.Error("Lỗi trong quá trình lưu nút", ex);
     }
 }