Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesModule Load ExceptionModule Load Exception
Previous
 
Next
New Post
2/1/2011 5:24 AM
 
Hi
I'm trying to implement the Tooltipified RadGrid in my web user control but I got following error; please help me to resolve it.

Error: TestToolTip is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.UI.Modules.ModuleHost.LoadModuleControl() --- End of inner exception stack trace ---

My code snippets:

TestToolTip.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestToolTip.ascx.cs" Inherits="SU_SaleStatisticImport.TestToolTip" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="Telerik" %>
<%@ Register Src="ActivityDetails.ascx" TagName="ActivityDetails" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml...">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server">
    </asp:ScriptManager>
    <Telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </Telerik:RadAjaxLoadingPanel>
    <Telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="ManualClose"
        Width="250" Height="350" runat="server" EnableShadow="true" OnAjaxUpdate="OnAjaxUpdate"
        RelativeTo="Element" Position="MiddleRight">
    </Telerik:RadToolTipManager>
    <Telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <Telerik:AjaxSetting AjaxControlID="rgCampaigns">
                <UpdatedControls>
                    <Telerik:AjaxUpdatedControl ControlID="rgCampaigns" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <Telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" />
                </UpdatedControls>
            </Telerik:AjaxSetting>
        </AjaxSettings>
    </Telerik:RadAjaxManager>
    <Telerik:RadGrid ID="rgCampaigns" runat="server" OnItemDataBound="rgCampaigns_ItemDataBound"
        AutoGenerateColumns="false">
        <MasterTableView runat="server" DataKeyNames="GlobalCode">
            <Columns>
                <Telerik:GridTemplateColumn HeaderText="First">
                    <ItemTemplate>
                        <asp:Label ID="lblTitle" runat="server" Text="Show ToolTip"></asp:Label>
                    </ItemTemplate>
                </Telerik:GridTemplateColumn>
                <Telerik:GridBoundColumn DataField="SecondColumn" HeaderText="Second">
                </Telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </Telerik:RadGrid>
    </form>
</body>
</html>

TestToolTip.ascx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Entities.Modules.Communications;
using DotNetNuke.Entities.Modules.Definitions;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using SaleStatisticImport;
 
namespace SU_SaleStatisticImport
{
    public partial class TestToolTip : System.Web.UI.UserControl
    {
        protected System.Data.DataTable GetData()
        {
            System.Data.DataTable tbl = new System.Data.DataTable();
            tbl.Columns.Add(new System.Data.DataColumn("GlobalCode"));
            tbl.Columns.Add(new System.Data.DataColumn("SecondColumn"));
            tbl.Columns.Add(new System.Data.DataColumn("ThirdColumn"));
            tbl.Columns.Add(new System.Data.DataColumn("FourthColumn"));
            tbl.Rows.Add(new object[] { "firstRecord1", "firstRecord2", "firstRecord3", "firstRecord4" });
            tbl.Rows.Add(new object[] { "secondRecord1", "secondRecord2", "secondRecord3", "secondRecord4" });
            tbl.Rows.Add(new object[] { "thirdRecord1", "thirdRecord2", "thirdRecord3", "thirdRecord4" });
            return tbl;
 
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                rgCampaigns.DataSource = GetData();
                rgCampaigns.DataBind();
            }
        }
 
        protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
        {
            this.UpdateToolTip(args.Value, args.UpdatePanel);
        }
        private void UpdateToolTip(string ActivityCode, UpdatePanel panel)
        {
            Control ctrl = Page.LoadControl("~/ActivityDetails.ascx");
            panel.ContentTemplateContainer.Controls.Add(ctrl);
 
            ActivityDetails details = (ActivityDetails)ctrl;
            details.ActivityCode = ActivityCode;
 
        }
 
        protected void rgCampaigns_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
 
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                Control target = e.Item.FindControl("lblTitle");
                if (!Object.Equals(target, null))
                {
                    if (!Object.Equals(this.RadToolTipManager1, null))
                    {
                        //Add the button (target) id to the tooltip manager
                        this.RadToolTipManager1.TargetControls.Add(target.ClientID, (e.Item as GridDataItem).GetDataKeyValue("GlobalCode").ToString(), true);
 
                    }
                }
            }
 
 
        }
    }
}

ActivityDetails.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ActivityDetails.ascx.cs" Inherits="SU_SaleStatisticImport.ActivityDetails" %>
<asp:label id="lbltest" runat="server" text="Label"></asp:label>

ActivityDetails.ascx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using Telerik.Web.UI;
using SaleStatisticImport;
 
namespace SU_SaleStatisticImport
{
    public partial class ActivityDetails : System.Web.UI.UserControl
    {
        public string ActivityCode
        {
            get
            {
                if (ViewState["ActivityCode"] == null)
                {
                    return "";
                }
                return (string)ViewState["ActivityCode"];
            }
            set
            {
 
                ViewState["ActivityCode"] = value;
 
            }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            lbltest.Text += "<br>Activity code: " + ActivityCode;
        }
    }
}
 
New Post
2/1/2011 8:58 AM
Accepted Answer 
I can see several issues immediately:

1. A module control, which is essentially a UserControl (.ascx), should not include page (.aspx) markup tags and directives such as !DOCTYPE, htm, head, body,and form.

2. Since a module control will be loaded into Default.aspx which already contains a form tag and since an ASP.Net page cannot contain more than one form tag with the runat="server" attribute, the module control can NOT include a form tag.

3. DotNetNuke already injects an AJAX ScriptManager control into the page and as there can be only one ScriptManager control on a page, your module control should NOT include one.

4. In order to participate in module loading, your module control must inherit from DotNetNuke.Entities.Modules.PortalModuleBase or ModuleSettingsBase. This requirement is the cause of your null reference exception.

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
2/2/2011 2:48 AM
 
Yes, Thanks alot William. The total issue has been resolved.
Cheers.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesModule Load ExceptionModule Load Exception


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out