Results 1 to 5 of 5

Thread: User control - Object

  1. #1
    Join Date
    Feb 2007
    Posts
    16

    Default User control - Object

    Hello again,

    I'm having some trouble getting DI to work on a user control. It seems much the same as this thread: http://forum.springframework.net/showthread.php?t=1542 but I've tried everything on there and no luck so far.

    I'm extending Spring.Web.UI.UserControl for my control. I'm using ASP.NET 2.0 with master pages. I've changed my masterpages to extend Spring.Web.UI.MasterPage and each page now extends Spring.Web.UI.Page.

    My custom control is used in the Master.master masterpage like so:

    Code:
    <%@ Master Language="C#" AutoEventWireup="true" Inherits="index" Codebehind="Master.master.cs" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="~/assets/css/site.css" />
    <script type="text/javascript" src="<%# ResolveUrl("~/assets/js/common.js") %>"></script>
    <title>iLogistics master page</title>
    </head>
    <body>
    <form id="pageForm" runat="server">
    <asp:ScriptManager ID="ajaxScriptManager" runat="server" />
    <div id="container">
      <div id="top-links"><iLogistics:LoggedIn ID="currentUser" runat="server" />...........
    I have the tag defined in Web.config as:

    Code:
    <add tagPrefix="iLogistics" tagName="LoggedIn" src="~/controls/user/LoggedIn.ascx" />
    My pages xml file follows this design:

    Code:
    <object id="basePage" abstract="true">
        <property name="MasterPageFile" value="~/masterPages/Master.master" />
      </object>
    
      <object id="basePopup" abstract="true">
        <property name="MasterPageFile" value="~/masterPages/PopUp.master" />
      </object>
    
      <object type="~/index.aspx" parent="basePage"></object>
      
      <!-- About pages -->
    
      <!-- Customer pages -->
      <object type="~/Customers/addCustomer.aspx" parent="basePage">
        <property name="CustomerManager" ref="CustomerManager" />
      </object>
    Finally, my control is defined as:

    Code:
    <object id="iLogistics.Web.Controls.User.LoggedIn" abstract="true">
        <property name="UserManager" ref="UserManager" />
      </object>
    I think thats everything but I still cannot make it work. Oh yeah and I'm using the SpringHibernate12 version of Spring from the most recent nightly build.

    Many thanks if you are able to help.

    Cheers

    Stephen

  2. #2
    Join Date
    Feb 2007
    Posts
    16

    Default

    Just in case anyone else has this problem I managed to solve it by using the following format for my control definitions:

    Code:
    <object type="~/controls/user/LoggedIn.ascx" abstract="true">
        <property name="UserManager" ref="UserManager" />
      </object>
    I believe in the docs it says to use
    Code:
    <object id="......"
    however I could never get this to work.

    Thanks

  3. #3
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi,

    I'm really sorry for the inconvenience. I changed UserControl configuration a while ago but obviously forgot to update the reference documentation.

    UserControls are configured exactly as shown by your example:

    Code:
    <object type="~/controls/user/LoggedIn.ascx" abstract="true">
        <property name="UserManager" ref="UserManager" />
    </object>
    cheers,
    Erich

  4. #4
    Join Date
    Feb 2007
    Posts
    16

    Default

    Hi Erich,

    No worries - if I can submit some updated documentation to help things I am happy to do so. I think it's a great project and although I've had a few problems I find the structure and maintainability of my application is much improved.

    Cheers

    Stephen

  5. #5
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi Stephen,

    if I can submit some updated documentation to help things I am happy to do so
    We are happy about any helping hand. If you like to help us out, submit your changes/additions here in the forum or - better - to the developer's mailinglist. You can find the necessary links on our homepage. Information on how to set up and build the documentation, please see our Wiki

    Let us know, if you need further information. I'll be glad to help you getting started.

    cheers,
    Erich

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •