V 1.9 Dynamic Featured Product Slider

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
tricky note here for some reason sometimes the designer.cs will not update itself and the added literal control will not be found in the code behind.  If this is the case I would check to ensure the following line is in the slider.ascx.designer.cs file

protected global::System.Web.UI.WebControls.Literal lSliderContent;
12 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Slider
/// </summary>
public class Slider
{
    protected global::System.Web.UI.WebControls.Literal lSliderContent;
  public Slider()
  {
    //
    // TODO: Add constructor logic here
    //
  }
}


is that correct?
is so, it still does not work. btw i had to create this designer file manually.
12 years ago
And you followed the directions in the first post of this topic?  
Are you using v1.9?
Did download the entire source code for v1.9?
What version of visual studio are you using?
12 years ago
yes..

VS 2010
12 years ago
can you confirm if the designer page i posted is correct?
12 years ago
namespace NopSolutions.NopCommerce.Web.Modules
{
    public partial class Slider : BaseNopFrontendUserControl
    {


NOT

public class Slider
{



If you can go back and re read the first post and make sure you follow each direction I am sure it will work.
If it does not please post your exact code in your slider .cs file here
12 years ago
this is my class:

using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.Categories;
using NopSolutions.NopCommerce.BusinessLogic.Media;
using NopSolutions.NopCommerce.BusinessLogic.Products;
using NopSolutions.NopCommerce.BusinessLogic.SEO;
using NopSolutions.NopCommerce.Common.Utils;
using NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings;
using NopSolutions.NopCommerce.BusinessLogic.Infrastructure;

namespace NopSolutions.NopCommerce.Web.Modules
{
    public partial class Slider : BaseNopFrontendUserControl
    {

        string sContent = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            BindData();
        }
        private void BindData()
        {
            string sImageUrl = string.Empty;
            sContent = "<dl class='slidedeck'>";
            var products = this.ProductService.GetAllProductsDisplayedOnHomePage();
            foreach (Product prd in products)
            {
                string productURL = SEOHelper.GetProductUrl(prd);
                sImageUrl = string.Empty;

                //tab text goes here
                sContent += "<dt>";
                sContent += prd.Name;
                sContent += "</dt>";

                //tab content goes here
                // you can add what ever formatted product attributes you want in this place below...
                sContent += "<dd>";

                var picture = prd.DefaultPicture;
                if (picture != null)
                    sImageUrl = this.PictureService.GetPictureUrl(picture, this.SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125), true);
                else
                    sImageUrl = this.PictureService.GetDefaultPictureUrl(this.SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125));

                sContent += "<a href='" + productURL + "'>";
                sContent += "<img src='" + sImageUrl + "'>";
                sContent += "</a>";

                sContent += "</dd>";
            }
            sContent += "</dl>";
            lSliderContent.Text = sContent;
        }
    }
}


lSliderContent at the bottom has a line zig zag line underneath.

"The name 'lSliderContent' does not exist in the current context
12 years ago
How did you add the file  Slider.ascx?

Did you right click the Modules folder and select add new item, and the new item would be a web then web user control

I ask because you said you had to manually create the designer file? In an above post you said
"btw i had to create this designer file manually."

That file should have been created for you?

Go back a try to add a new module for a test and tell me if you get three files created.
test.aspx
test.cs
test.designer.cs

Did you change the project type from an application to a website?
Did you download the non behind code version? If so this wont work for you.
12 years ago
right clicked the modules folder and did exactly what you said, it created the aspx file and the code behind.. but it didnt create the designer file.
12 years ago
I am sure you have the wrong source code to do this addition
You need to grab the source code version and open the project via the sln file in the root directory
The version you have is a website solution and not the web application solution.
Di you go to this link
http://nopcommerce.codeplex.com/releases/view/51059#DownloadId=176949
and download that version?

Somehow your project is not a web application project but a website project.
That is the only thing I can think of.  How did you open your project?  Did you open it with the NopCommerce.sln file or did you have to create the project via an existing website?


Go here and download this version of Nop and try the test again after opening the project via the sln file in the root directory.


http://nopcommerce.codeplex.com/releases/view/51059#DownloadId=176949
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.