an ASP.NET Open Source CMS & eCommerce platform
Search:
Last Post 1/26/2009 4:16:31 PM By lukezy. 9 replies.
1/26/2009 12:01:40 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
SKU.ascx
 
 
What will be the code in SKU.ascx
1/26/2009 1:30:38 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: SKU.ascx
Sorry, I don't know what you are asking. What are you trying to do?
DotShoppingCart Staff
1/26/2009 1:49:42 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: SKU.ascx

 

 

I want  to add sku to Summary Grid, using this code :

        case "SKU":
                    c = LoadAndBindControl("/Store/ProductSummary/SKU.ascx");
                    break;


I need to create SKU.ascx, I copied the file from ProductName.ascx, but there is errors. so I need to change the script.

 

 

 
 
 
1/26/2009 2:00:19 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: SKU.ascx
Did you copy ProductName.ascx.cs as well?
DotShoppingCart Staff
1/26/2009 2:06:47 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: SKU.ascx
Yes I copied and renamed it to Sku.ascx but there is errors
1/26/2009 2:14:01 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: SKU.ascx
You cannot just copy everyting and expect it to work. You need to change the content as well. Do you have developer who knows ASP.NET?
DotShoppingCart Staff
1/26/2009 3:34:37 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: SKU.ascx
Yes I did change the content , but have some errors.
1/26/2009 3:36:31 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: SKU.ascx

This was your solution :

 
1) Create web\store\ProductSummary\SKU.ascx
2) Add the following code to productsummary.ascx.cs
<div style="margin: 0in 0in 0pt"><span style="font-size: 10pt">                <span style="color: blue">case</span> <span style="color: #a31515">"SKU"</span>:</span>
<div style="margin: 0in 0in 0pt"><span style="font-size: 10pt">                    c = LoadAndBindControl(<span style="color: #a31515">"/Store/ProductSummary/SKU.ascx"</span>);</span>
<div style="margin: 0in 0in 0pt"><span style="font-size: 10pt">                    <span style="color: blue">break</span>;</span>
 
<div style="margin: 0in 0in 0pt"> 
 
 
 
 
 
 
1/26/2009 4:04:45 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
Re: SKU.ascx

These are my changes :

Script is sku:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="sku.ascx.cs" Inherits="Controls_ProductSummary_sku" %>
<%# GetSku((string)Product.Sku) %>

 Code in sku.ascx.cs:


public partial class Controls_ProductSummary_sku : ProductSummaryUserControl {
    private const int maxLengthToDisplay = 10;

    protected void Page_Load(object sender, EventArgs e) {

    }
    protected string GetSku(string productSku)
    {
        if (string.IsNullOrEmpty(productSku))
            return string.Empty;

        if (productSku.Length <= maxLengthToDisplay)
            return productSku;

        return productSku.Substring(0, maxLengthToDisplay) + " ...";
    }

}

 

and the eror message :
Compiler Error Message: CS1061: 'DotShoppingCart.Commercial.Core.Product' does not contain a definition for 'Sku' and no extension method 'Sku' accepting a first argument of type 'DotShoppingCart.Commercial.Core.Product' could be found (are you missing a using directive or an assembly reference?)
 

 
 
1/26/2009 4:16:31 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: SKU.ascx

Use GetSku((string)Product.SKU

DotShoppingCart Staff