+1-888-365-2779
Try Now
More in this section

Forums / 3.x Pre-release forums (retired) / Module Admin Tools

Module Admin Tools

6 posts, 0 answered
  1. fregas baratis
    fregas baratis avatar
    185 posts
    Registered:
    14 Nov 2002
    01 Apr 2007
    Link to this post
    Guys,

    In the example module for jobs, all actions are done in one control in one page: listing news items, creating and deleting them.  is there a way to have your admin tool split up among various pages rather than in one control?  Breaking things up is pretty important when it comes to code readability.

    Thanks,
    Craig
  2. Bob
    Bob avatar
    330 posts
    Registered:
    24 Sep 2012
    02 Apr 2007
    Link to this post
    Hello Craig,

    You cannot split the Control Panel in various pages but you can crate multiple User Controls and load them when needed which is basically the same. In the Jobs example instead of using Multi Page you can do something like this:

    public void SetMode(JobConfigurationMode jobConfigurationMode)
    {
        
    UserControl ctlr;
        
    switch (jobConfigurationMode)
        
    {
            
    case JobConfigurationMode.Category:
                
    ctrl = this.Page.LoadControl("~/UserControls/Category.ascx");
                
    break;
            case JobConfigurationMode.Type:
                
    ctrl = this.Page.LoadControl("~/UserControls/Type.ascx");
                
    break;
        }
        
    this.PlaceHolder1.Controls.Add(ctrl);
    }

    Sincerely yours,
    Bob
    the telerik team

    Instantly find answers to your questions at the new telerik Support Center
  3. fregas baratis
    fregas baratis avatar
    185 posts
    Registered:
    14 Nov 2002
    02 Apr 2007
    Link to this post
    Yeah thats what i ended up doing over the weekend.  Its just cleaner if they could be seperate pages, and it would allow them to send links to or bookmark certain parts of the admin.  Not a huge requirement but some users may want to do it.

    Craig
  4. Bob
    Bob avatar
    330 posts
    Registered:
    24 Sep 2012
    03 Apr 2007
    Link to this post
    Hi Craig,

    You still can send links and bookmark them if you do it with parameters in the query string instead of using postbacks.

    Sincerely yours,
    Bob
    the telerik team

    Instantly find answers to your questions at the new telerik Support Center
  5. fregas baratis
    fregas baratis avatar
    185 posts
    Registered:
    14 Nov 2002
    05 Apr 2007
    Link to this post
    How would i do that?  I thought everything had to be in one page?
  6. Bob
    Bob avatar
    330 posts
    Registered:
    24 Sep 2012
    06 Apr 2007
    Link to this post
    Hi Craig,

    That’s right everything has to be on one page. So instead of using button controls with post back, you use hyper links with parameters in the query string for your commands.

    In the previous example this would be:

    <a href="~/Admin/Modules.aspx?module=MyModule&ConfigMode=Category" runat="server">Category</a>

    <a href="~/Admin/Modules.aspx?module=MyModule&ConfigMode=Type" runat="server">Type</a>

    public partial class MyModule_ControlPanel : UserControl, IControlPanel

        
    protected void Page_Load(object sender, EventArgs e)
        
    {
            
    UserControl ctlr;
            
    switch (Request["ConfigMode"])
            
    {
                
    case "Category":
                    
    ctrl = Page.LoadControl("~/UserControls/Category.ascx");
                    
    break;
                
    case "Type":
                    
    ctrl = Page.LoadControl("~/UserControls/Type.ascx");
                    
    break;
                
    default:
                    
    //Something else
                    
    break;
            }
            
    this.PlaceHolder1.Controls.Add(ctrl);
        
    }
    }

    Kind regards,
    Bob
    the telerik team

    Instantly find answers to your questions at the new telerik Support Center
Register for webinar
6 posts, 0 answered