How to add lightbox feature in other pages ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 anos atrás
Great!!!

My friend barry has returned to handle the situation...hehe

thanks barry for replying back... Just to make sure, this is how root.master should look like ? Because right now this gives an error message saying "Expected class, delegate, enum, interface, or struct"

Root.master.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CommonHelper;
using NopSolutions.NopCommerce.Common.Utils;



namespace NopSolutions.NopCommerce.Web.MasterPages
{

    public partial class root : BaseNopMasterPage
    {
    }

    protected override void OnPreRender(EventArgs e)
    {
        string jquery = CommonHelper.GetStoreLocation() + "Scripts/jquery-1.4.min.js";
        Page.ClientScript.RegisterClientScriptInclude(jquery, jquery);

        string slimbox = CommonHelper.GetStoreLocation() + "Scripts/slimbox2.js";
        Page.ClientScript.RegisterClientScriptInclude(slimbox, slimbox);
    }
}



My root.master page

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Root.Master.cs" Inherits="NopSolutions.NopCommerce.Web.MasterPages.root" %>
<%@ Register TagPrefix="nopCommerce" TagName="Header" Src="~/Modules/Header.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="HeaderMenu" Src="~/Modules/HeaderMenu.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="Footer" Src="~/Modules/Footer.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="GoogleAdsense" Src="~/Modules/GoogleAdsense.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="WebAnalytics" Src="~/Modules/WebAnalytics.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="SimpleTextBox" Src="~/Modules/SimpleTextBox.ascx" %>

<!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 id="Head1" runat="server">
    <title></title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />

    <ajaxToolKit:ToolkitScriptManager runat="server" EnableScriptGlobalization="true"
EnableScriptLocalization="true" ID="smRoot" ScriptMode="Release" CompositeScript-ScriptMode="Release" />
</head>

<body>
....body code...
</body>
</html>
13 anos atrás
Make it look like this:

namespace NopSolutions.NopCommerce.Web.MasterPages
{
    public partial class root : BaseNopMasterPage
    {
       protected override void OnPreRender(EventArgs e)
       {
           string jquery = CommonHelper.GetStoreLocation() + "Scripts/jquery-1.4.min.js";
           Page.ClientScript.RegisterClientScriptInclude(jquery, jquery);
  
           string slimbox = CommonHelper.GetStoreLocation() + "Scripts/slimbox2.js";
           Page.ClientScript.RegisterClientScriptInclude(slimbox, slimbox);
       }
    }
}

Put the "OnPreRender" inside the "public partial class root : BaseNopMasterPage"...

"Expected class, delegate, enum, interface, or struct" means that you have code outside the class definition...
13 anos atrás
Also, I don't know if it makes any difference... but I have my script manager inside "<div class="master-wrapper-content">"... not in the header.
13 anos atrás
Also... I was wrong about the "rel" tag meaning... you just have to have "lightbox" in the rel tag... the "lightbox-pd" probably just means "product description". Adding a dash -pd or something else just tells the lightbox what pictures are in that group - I believe.
13 anos atrás
ARRRGGHH... I also forgot this line in the OnPreRender after the scripts being registered:

base.OnPreRender(e);

Don't know if that makes a difference... but I have that there...
13 anos atrás
barry can you share your master page and master page .cs (both page source code) here so that i don't miss anything ?
13 anos atrás
I have extra stuff that you don't need because I put in some ajax cart stuff... but here they are:

root.master.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NopSolutions.NopCommerce.Common.Utils;


namespace NopSolutions.NopCommerce.Web.MasterPages
{
    public partial class root : BaseNopMasterPage
    {
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            smRoot.RegisterAsyncPostBackControl(cph1);

        }
        protected override void OnPreRender(EventArgs e)
        {

            string jquery = CommonHelper.GetStoreLocation() + "Scripts/jquery-1.4.min.js";
            Page.ClientScript.RegisterClientScriptInclude(jquery, jquery);

            string slimBox = CommonHelper.GetStoreLocation() + "Scripts/slimbox2.js";
            Page.ClientScript.RegisterClientScriptInclude(slimBox, slimBox);

            base.OnPreRender(e);
        }
    }
}

root.master:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Root.Master.cs" Inherits="NopSolutions.NopCommerce.Web.MasterPages.root" %>

<%@ Register TagPrefix="nopCommerce" TagName="Header" Src="~/Modules/Header.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="HeaderMenu" Src="~/Modules/HeaderMenu.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="Footer" Src="~/Modules/Footer.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="GoogleAdsense" Src="~/Modules/GoogleAdsense.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="WebAnalytics" Src="~/Modules/WebAnalytics.ascx" %>
<!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 id="Head1" runat="server">
    <title></title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
</head>
<body>
    <form id="form1" runat="server">
    <div class="master-wrapper-page">
        <div class="master-wrapper-content">
            <ajaxToolkit:ToolkitScriptManager runat="Server" EnableScriptGlobalization="true"
                EnableScriptLocalization="true" ID="smRoot" ScriptMode="Release" CompositeScript-ScriptMode="Release" />
            <asp:UpdatePanel runat="server" ID="HeadPanel" UpdateMode="Conditional">
                <ContentTemplate>
                    <nopCommerce:Header ID="ctrlHeader" runat="server" />
                </ContentTemplate>
            </asp:UpdatePanel>
            <nopCommerce:HeaderMenu ID="ctrlHeaderMenu" runat="server" />
            <asp:ContentPlaceHolder ID="cph1" runat="server">
            </asp:ContentPlaceHolder>
            <div class="clear">
            </div>
        </div>
        <nopCommerce:GoogleAdsense runat="server" ID="ctrlGoogleAdsense" />
        <nopCommerce:Footer ID="ctrlFooter" runat="server" />
        <nopCommerce:WebAnalytics ID="ctrlWebAnalytics" runat="server" />
    </div>
    </form>
</body>
</html>
13 anos atrás
You can ignore the OnLoad method in the .cs file and the UpdatePanel in the root.master - they are for my Ajax add to cart feature...
13 anos atrás
ok barry i just testing lightbox feature on my project for other pages and everything is working perfectly fine

Thanks a lot for your help, i really appreciate it !!!
13 anos atrás
No thanks needed... donations would be nice :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.