Advertisement
Guest User

Custom node name in Umbraco Doc2Form

a guest
Aug 12th, 2010
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. // add this in section for private strings
  2. private string _customNodeName = "";
  3.  
  4. // add this in public properties
  5. // remember to add CustomNodeName as textstring property to your macro!
  6. public string CustomNodeName
  7. {
  8.     set { _customNodeName = value; }
  9. }
  10.  
  11. // change this in btnSubmit_Click private function
  12.   if (!_editMode)
  13.     {
  14.     umbraco.cms.businesslogic.CMSNode parent = new umbraco.cms.businesslogic.CMSNode(_nodeId);
  15.     string text = Title.Text;
  16.     if (!_showTitle && text.Length == 0)
  17.     {
  18.             // if we set custom name, use that..
  19.              if (_customNodeName.Length > 0)
  20.             {
  21.               text = _customNodeName;        
  22.             }
  23.             else
  24.             {
  25.                 try
  26.                 {
  27.                   text = "RE: " + parent.Text;
  28.                 }
  29.                 catch
  30.                 {
  31.                   text = "Created by Doc2Form on " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
  32.                 }
  33.             }
  34.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement