NOP 1.9 datalist to asp:repeater

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
hey all

i want to change the home product datalist to a repeater

i found this :
https://www.nopcommerce.com/boards/t/3308/aspdatalist-to-a-asprepeater.aspx

but!

when i try to do it i cant compile the code..

when i do it step by step i get this error:


Error  1  c:\Users\Eldar\Dropbox\Development Farm\My Projects\Nop 1.9 from server\Modules\HomePageProducts.ascx(17): error CS1061: 'ASP.modules_homepageproducts_ascx' does not contain a definition for 'rptProducts_OnItemDataBound' and no extension method 'rptProducts_OnItemDataBound' accepting a first argument of type 'ASP.modules_homepageproducts_ascx' could be found (are you missing a using directive or an assembly reference?)    

Error  2  'ASP.modules_homepageproducts_ascx' does not contain a definition for 'rptProducts_OnItemDataBound' and no extension method 'rptProducts_OnItemDataBound' accepting a first argument of type 'ASP.modules_homepageproducts_ascx' could be found (are you missing a using directive or an assembly reference?)  C:\Users\Eldar\Dropbox\Development Farm\My Projects\Nop 1.9 from server\Modules\HomePageProducts.ascx  17  

Error  3  'ASP.modules_homepageproducts_ascx' does not contain a definition for 'rptProducts_OnItemDataBound' and no extension method 'rptProducts_OnItemDataBound' accepting a first argument of type 'ASP.modules_homepageproducts_ascx' could be found (are you missing a using directive or an assembly reference?)  C:\Users\Eldar\Dropbox\Development Farm\My Projects\Nop 1.9 from server\Modules\HomePageProducts.ascx  17
13 years ago
i have changed the function in the cs file
but it seems it cant find it ?
13 years ago
Why don´t you remove the ItemDataBound event from your code and check if it works?

Then you can create the event if you are going to use it.

I've replaced my Datalists with repeaters for the category templates and I do not use the event for anything.


<asp:Repeater ID="rptProducts" runat="server">
        <HeaderTemplate> <ul class="item-box"></HeaderTemplate>
        <ItemTemplate><li class="item-box-cnt"><nopCommerce:ProductBox1 ID="ctrlProductBox" Product='<%# Container.DataItem %>'
                    runat="server" /></li></ItemTemplate>
        <FooterTemplate></ul></FooterTemplate>
    </asp:Repeater>

---
protected void BindData()
        {
            var category = this.CategoryService.GetCategoryById(this.CategoryId);

            ....

        
            var productCollection =  this.ProductService.GetAllProducts(this.CategoryId, out totalRecords);

            if (productCollection.Count > 0)
            {


                this.rptProducts.DataSource = productCollection;
                this.rptProducts.DataBind();
            }
            else
            {
                this.rptProducts.Visible = false;

            }
        }


I hope this works for you.

Jorge
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.