Copied to clipboard

Flag this post as spam?

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


  • Rahul 12 posts 83 karma points
    Mar 21, 2014 @ 14:45
    Rahul
    0

    How can I create Form in Admin(Back office) to take input by admin and store it to data base

    Hi Everyone,

    I am new in Umbraco and I want to create a Announcement type Functionality in Umbraco Website.

    In Announcement there is a form under a section Announcemnts where admin can create new announcement with some properties.

    And in the front end I want to show these Announcements by fetching Announcements from data base.

    Please suggest how can I create a form in Admin Back office in Umbraco.

    I am Using Umbraco version 6.1.6.

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 22, 2014 @ 16:45
    Jan Skovgaard
    100

    Hi Rahul

    You have a couple of options

    1: You can create a custom section, which only administrator users can see and access and then have your own trees where the administrator can enter dats that is written to your external database.

    2: You can create a dashboard, which can also be setup so only administrators can access them when they're being logged in where you can reference your own user control, that can display the form.

    3: You can add a custom datatype (Please note this is based on using user controls, this might not make sense if you're running MVC mode) with your form, which can be used on a certain document type and then use the tabHiderPackage to make sure only your administrator can see the tab containing the form.

    From the sound of your post it seems to me that using a dashboard is the most straight forward option if it's only one form that should be used to manipulate the database.

    How do you want to query the data to be displayed on the frontend? I imagine you want to use a macro based on either Razor, XSLT or user controls or perhaps surface controllers?

    Looking forward to hearing from you.

    /Jan

  • Rahul 12 posts 83 karma points
    Mar 24, 2014 @ 06:34
    Rahul
    0

    Hi Jan Skovgaard,

    Thanks for the reply......

    I want to use macro based on User Control.

    I tried first option(Custom Section and Tree) before asking question. I successfully created Custom Section but failed to create Custom tree on that Cutom section also futher analysing not found any solution how can we add custom form to this tree where admin can insert data.

    Can you please guide me good tutorial to create custom tree under custom section and add or load a user control to this specific node?

     

     

     

  • Rahul 12 posts 83 karma points
    Mar 24, 2014 @ 14:15
    Rahul
    0

    Hi Jan Skovgaard,

    I tried again to create tree this time its created but its not showing the aspx page which I need to show on the click of this node.

    Code for the tree file is:

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Web;

    using umbraco.cms.presentation.Trees;

    using umbraco.businesslogic;

    using System.Text;

     

    namespace CustomTreeAdmin

    {

        [Tree("CustomSection", "AnnouncementTree", "Announcements")]

        public class Announcements : BaseTree

        {

            public Announcements(string application) : base(application) { }

     

            protected override void CreateRootNode(ref XmlTreeNode rootNode)

            {

                rootNode.Icon = FolderIcon;

                rootNode.OpenIcon = FolderIconOpen;

                rootNode.NodeType = "init" + TreeAlias;

                rootNode.NodeID = "init";

            }

     

            public override void RenderJS(ref StringBuilder Javascript)

            {

                Javascript.Append(

                @"

                function AnnouncementNewForm(id) {

                parent.right.document.location.href = 'Umbraco/NewAnnouncement.aspx?id=' + id;

                }");

            }

     

            public override void Render(ref XmlTree tree)

            {

                XmlTreeNode xNode = XmlTreeNode.Create(this);

                xNode.NodeID = "1";

                xNode.Text = "AnnouncementTree";

                //xNode.Icon = "subscribers.gif";

                xNode.Action = "javascript:AnnouncementNewForm("+id+")";

                tree.Add(xNode);

            }

        }   

    }

     

    I checked the console there is an error as shown below:

    What I am getting on the Screen:

     

     

    Can you guide me what I am doing wrong.. or help me  how can I get aspx page to the tree node click.

     

Please Sign in or register to post replies

Write your reply to:

Draft