Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • RoelAlblas 50 posts 61 karma points
    Nov 01, 2009 @ 18:44
    RoelAlblas
    0

    problem with create a new node

    Hi,

    I get the following error when I create a new node in self configured tree

    Input string was not in a correct format.

    I just don't see what I'm doing wrong here. This is my code in the save event of a class inherited with ITaskReturnUrl

    public

     

    bool Save()

    {

     

    int idReturned =

     

    Application.SqlHelper.ExecuteScalar<int>

    (

     

    "INSERT INTO ketelstoringen_sup_supplier(sup_name) VALUES(@sup_name), SELECT @@Identity",

     

    Application.SqlHelper.CreateParameter("@sup_name", Alias)

    );

    _returnUrl =

    string.Format("plugins/loadSupplier.aspx?id={0}", idReturned);

     

    return true;

    }

     

    sup_name is varchar field of 254 and the identity is there a sup_id that is incremental and a primary key. I didn't figure out where Alias comes from but it should be the textfield. Its configured in the class like this:

     

     

    public string Alias

    {

     

    get

    {

     

    return _alias;

    }

     

    set

    {

    _alias =

    value;

    }

    }

     The UI.xml is created like this:

    <

     

    nodeType alias="supplier">

    <

     

    header>Supplier</header>

    <

     

    usercontrol>/create/simple.ascx</usercontrol>

    <

     

    tasks>

    <

     

    create assembly="Ketelstoringen" type="ketelstoringenSupplierTasks" />

    <

     

    delete assembly="Ketelstoringen" type="ketelstoringenSupplierTasks" />

    </

     

    tasks>

    </

     

    nodeType>

     The delete function is working so I don't think there is a problem in ui.xml

    Everything looks fine to me but there is some hick up. Can anyone solve my blindness ...?

    Thanks!

    Roel

  • RoelAlblas 50 posts 61 karma points
    Nov 04, 2009 @ 20:47
    RoelAlblas
    0

    Anyone having a suggestion? I just don't get it to work.

    Thanks!

    Roel

  • RoelAlblas 50 posts 61 karma points
    Nov 08, 2009 @ 18:50
    RoelAlblas
    0

    Solved!!

    NodeId was a string instead of an integer.

  • Max 144 posts 166 karma points
    May 30, 2012 @ 10:54
    Max
    0

    how did you solve it please suggest  thank you

    here is my code

     public class LoadIssueTree: BaseTree
        {
            public LoadIssueTree(string application) : base(application) { }

            protected BaseTree _baseTree;
            protected override void CreateRootNode(ref XmlTreeNode rootNode)
            {
                rootNode.Icon = FolderIcon;
                rootNode.OpenIcon = FolderIconOpen;
                rootNode.NodeType = TreeAlias;
                rootNode.NodeID = "init";

              

            }
          
            protected override void CreateRootNodeActions(ref List<IAction> actions)
            {
                actions.Clear();
               
                actions.Add(ContextMenuSeperator.Instance);
                actions.Add(ActionRefresh.Instance);
               
               

              
            }
     public override void Render(ref XmlTree tree)
            {

               

             
                   if (string.IsNullOrEmpty(this.NodeKey)) {
                    //Add the first level
                 
                    XmlTreeNode xNodeProfileKeywords = XmlTreeNode.Create(this);
                    xNodeProfileKeywords.NodeID = "manageIssues";
                    xNodeProfileKeywords.NodeType = "manageIssues";
                    xNodeProfileKeywords.Text = "IssuesMain";
                    xNodeProfileKeywords.Icon = "folder.gif";
                    xNodeProfileKeywords.HasChildren = true;
                    xNodeProfileKeywords.Source = this.GetTreeServiceUrl(xNodeProfileKeywords.NodeID);
                    xNodeProfileKeywords.Menu.Clear();
                    xNodeProfileKeywords.Menu.AddRange(new List<IAction>() { ActionNew.Instance });
                   // xNodeProfileKeywords.Menu.AddRange(new List<IAction>() { ActionDelete.Instance });
                    xNodeProfileKeywords.Menu.AddRange(new List<IAction>() { ActionRefresh.Instance });
                 
                    tree.Add(xNodeProfileKeywords);


                    XmlTreeNode xNodeCompanies = XmlTreeNode.Create(this);
                    xNodeCompanies.NodeID = "manageIssueStatus";
                    xNodeCompanies.NodeType = "manageIssueStatus";
                    xNodeCompanies.Text = "IssuesStatus";
                    xNodeCompanies.Icon = "folder.gif";
                    xNodeCompanies.HasChildren = true;
                    xNodeCompanies.Source = this.GetTreeServiceUrl(xNodeCompanies.NodeID);
                    xNodeCompanies.Menu.Clear();
                    xNodeCompanies.Menu.AddRange(new List<IAction>() { ActionNew.Instance });

                   //xNodeCompanies.Menu.AddRange(new List<IAction>() { ActionDelete.Instance });
                   xNodeCompanies.Menu.AddRange(new List<IAction>() { ActionRefresh.Instance });
                    tree.Add(xNodeCompanies);

                    XmlTreeNode xNodepriority = XmlTreeNode.Create(this);
                    xNodepriority.NodeID = "manageIssuesPriority";
                    xNodepriority.NodeType = "manageIssuesPriority";
                    xNodepriority.Text = "IssuesPriority";
                    xNodepriority.Icon = "folder.gif";
                    xNodepriority.HasChildren = true;
                    xNodepriority.Source = this.GetTreeServiceUrl(xNodepriority.NodeID);
                    xNodepriority.Menu.Clear();
                    xNodepriority.Menu.AddRange(new List<IAction>() { ActionNew.Instance });
                   // xNodepriority.Menu.AddRange(new List<IAction>() { ActionDelete.Instance });
                    xNodepriority.Menu.AddRange(new List<IAction>() { ActionRefresh.Instance });

                    tree.Add(xNodepriority);

                    XmlTreeNode xNodecat = XmlTreeNode.Create(this);
                    xNodecat.NodeID = "manageIssuesCategory";
                    xNodecat.NodeType = "manageIssuesCategory";
                    xNodecat.Text = "IssuesCategory";
                    xNodecat.Icon = "folder.gif";
                    xNodecat.HasChildren = true;
                    xNodecat.Source = this.GetTreeServiceUrl(xNodecat.NodeID);
                    xNodecat.Menu.Clear();
                    xNodecat.Menu.AddRange(new List<IAction>() { ActionNew.Instance });
                   // xNodecat.Menu.AddRange(new List<IAction>() { ActionDelete.Instance });
                    xNodecat.Menu.AddRange(new List<IAction>() { ActionRefresh.Instance });
                    tree.Add(xNodecat);

                   }
                   else if (this.NodeKey == "manageIssues")
                   {
                       IRecordsReader reader = Application.SqlHelper.ExecuteReader("select * from IssuesTable");

                       while (reader.Read())
                       {
                           XmlTreeNode xNode = XmlTreeNode.Create(this);
                           xNode.NodeID = reader.GetInt("ID").ToString();
                           xNode.NodeType = "issues";                                        
                           xNode.Text = reader.GetString("IssueName");
                           xNode.Icon = "docPic.gif";
                           xNode.Action = "javascript:openIssueTree(" + reader.GetInt("id").ToString() + ")";

                           tree.Add(xNode);

                       }
                    }
                      
                   else if (this.NodeKey == "manageIssueStatus")
                   {

                       IRecordsReader reader = Application.SqlHelper.ExecuteReader("select * from IssueStatus");

                       while (reader.Read())
                       {
                           XmlTreeNode xNode = XmlTreeNode.Create(this);
                           xNode.NodeID = reader.GetInt("StatusID").ToString();
                           xNode.Text = reader.GetString("IssueStatus");
                           xNode.Icon = "wall-brick.png";
                           xNode.Action = "javascript:openIssueStatus(" + reader.GetInt("StatusID").ToString() + ")";
                           xNode.Menu.Clear();
                          // xNode.Menu.AddRange(new List<IAction>() { ActionNew.Instance });
                           xNode.Menu.Add(ActionDelete.Instance);
                           tree.Add(xNode);

                       }
                  
                   }
                   else if (this.NodeKey == "manageIssuesPriority")
                   {

                       IRecordsReader reader = Application.SqlHelper.ExecuteReader("select * from IssuesPriority");

                       while (reader.Read())
                       {
                           XmlTreeNode xNode = XmlTreeNode.Create(this);
                           xNode.NodeID = reader.GetInt("PriorityID").ToString();
                           xNode.Text = reader.GetString("Priority");
                           xNode.Icon = "wand.png";
                           xNode.Action = "javascript:openIssuePriority(" + reader.GetInt("PriorityID").ToString() + ")";
                           xNode.Menu.Clear();
                           //xNode.Menu.AddRange(new List<IAction>() { ActionNew.Instance });
                           xNode.Menu.Add(ActionDelete.Instance);
                           tree.Add(xNode);

                       }

                   }
                   else if (this.NodeKey == "manageIssuesCategory")
                   {

                       IRecordsReader reader = Application.SqlHelper.ExecuteReader("select * from IssuesCategory");

                       while (reader.Read())
                       {
                           XmlTreeNode xNode = XmlTreeNode.Create(this);
                           xNode.NodeID = reader.GetInt("CategoryID").ToString();
                           xNode.Text = reader.GetString("IssuesCategory");
                           xNode.Icon = "zone.png";
                           xNode.Action = "javascript:openIssuesCategory(" + reader.GetInt("CategoryID").ToString() + ")";
                           xNode.Menu.Clear();
                           //xNode.Menu.AddRange(new List<IAction>() { ActionNew.Instance });
                           xNode.Menu.Add(ActionDelete.Instance);
                           tree.Add(xNode);

                       }

                   }
                  
            }
            public TreeService GetTreeService(int keyId, string nodeKey)
            {
                return new TreeService(keyId, _baseTree.TreeAlias, _baseTree.ShowContextMenu, _baseTree.IsDialog, _baseTree.DialogMode, _baseTree.app, nodeKey);
            }
          

          
          
            public override void RenderJS(ref StringBuilder Javascript)
            {
                Javascript.Append(
                   @"
                        function openIssueTree(id) {
                            parent.right.document.location.href = 'plugins/editIssues.aspx?id=' + id;
                        }
                   
                  
                        function openIssueStatus(id) {
                            parent.right.document.location.href = 'plugins/editIssueStatus.aspx?id=' + id;
                        }
                  
                     function openIssuePriority(id) {
                            parent.right.document.location.href = 'plugins/editIssuePriority.aspx?id=' + id;
                        }
                   function openIssuesCategory(id) {
                            parent.right.document.location.href = 'plugins/editIssuesCategory.aspx?id=' + id;
                        }
                  
                   ");

              
            }
        }

     

    mu Ui  file



    <nodeType alias="manageIssues">
            <header>IssuesMain</header>
             <usercontrol>/create/simple.ascx</usercontrol>
            <tasks>
           <create assembly="IssuesUmbracoSection" type="Tasks.IssueTask" />
          <delete assembly="IssuesUmbracoSection" type="Tasks.IssueTask" />
            </tasks>
        </nodeType>
        <nodeType alias="manageIssueStatus">
            <header>IssueStatus</header>
            <usercontrol>/create/simple.ascx</usercontrol>
            <tasks>
           <create assembly="IssuesUmbracoSection" type="Tasks.IssueStatusTasks" />
          <delete assembly="IssuesUmbracoSection" type="Tasks.IssueStatusTasks" />
            </tasks>
        </nodeType>
        <nodeType alias="manageIssuesPriority">
            <header>IssuesPriority</header>
            <usercontrol>/create/simple.ascx</usercontrol>
            <tasks>
           <create assembly="IssuesUmbracoSection" type="Tasks.IssuePriorityTask" />
          <delete assembly="IssuesUmbracoSection" type="Tasks.IssuePriorityTask" />
            </tasks>
        </nodeType>
        <nodeType alias="manageIssuesCategory">
            <header>IssuesCategory</header>
            <usercontrol>/create/simple.ascx</usercontrol>
            <tasks>
           <create assembly="IssuesUmbracoSection" type="Tasks.IssuesCategoryTask" />
          <delete assembly="IssuesUmbracoSection" type="Tasks.IssuesCategoryTask" />
            </tasks>
        </nodeType>

     

     

    anu idea wny ItaskReturnUrl  create and delete nto working giving me string format errrors

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies