Copied to clipboard

Flag this post as spam?

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


  • Jakob Jensen 23 posts 43 karma points
    Feb 03, 2011 @ 10:16
    Jakob Jensen
    0

    Nullref in custom XSLT ext

    I have made my ovn extension in VS2010 it's contains

    Reminder.cs

    namespace EmailReminderShop
    {
        public class Reminder
        {
            public static string SendMail(int NodeId, string Email, int ReminderEmailNodeId)
            {
                string returnText = "testc";

                ReminderBLL BLL = new ReminderBLL();
                ReminderItem ReminderToInsert = new ReminderItem();

                ReminderToInsert.email = Email;
                ReminderToInsert.nodeId = NodeId;

                bool rowExist = BLL.InsertReminder(ReminderToInsert);

                if (rowExist)
                {
                    returnText = "Du er allerede tilmeldt en reminder på dette produkt";
                }
                else
                {
                    returnText = "Du er nu tilmeldt en reminder på dette produkt og vil modtage en E-mail når vi igen har varen på lager.";
                }

                return returnText;
            }

        }
    }

    ReminderBLL.cs
    ReminderDAL.cs
    ReminderItem.cs

    In the xsltconfig i have added:

    <ext assembly="EmailReminderShop" type="EmailReminderShop.Reminder" alias="myExt">
      </ext>

    in the xslt i use

    <xsl:value-of select="myExt:SendMail('1204', '[email protected]', '1115')"/>

    when i try to save it i get this

    System.NullReferenceException: Object reference not set to an instance of an object.
    at EmailReminderOccShop.ReminderDAL..ctor()
    at EmailReminderOccShop.ReminderBLL..ctor()
    at EmailReminderOccShop.Reminder.SendMail(Int32 NodeId, String Email, Int32 ReminderEmailNodeId)

    but why???

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 03, 2011 @ 10:21
    Jan Skovgaard
    0

    Hi Jakob

    Since you're using integers should'nt you the call the extension like

    <xsl:value-of select="myExt:SendMail(1204, '[email protected]', 1115)"/> - without the '' around the id's?

    /Jan

  • Jakob Jensen 23 posts 43 karma points
    Feb 03, 2011 @ 10:38
    Jakob Jensen
    0

    thx that help me to get a new error.

    Fogot to move my CustomTabel to the new SQLServer.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 03, 2011 @ 10:39
    Jan Skovgaard
    0

    Hi Jakob

    So this is solved or still bugging after the CustomTabel was moved over?

    /Jan

  • Jakob Jensen 23 posts 43 karma points
    Feb 03, 2011 @ 10:46
    Jakob Jensen
    0

    that solved it thx :-)

Please Sign in or register to post replies

Write your reply to:

Draft