# Region parameter attributes
// Arrangement
Int m_type = 0;
Public int type
{
Get {return m_type ;}
Set {m_type = value ;}
}
// Product category
Int m_productclass =-1;
Public int productclass
{
Get {return m_productclass ;}
Set {m_productclass = value ;}
}
// Brand Type
Int m_brandcategory = 0;
Public int brandcategory
{
Get {return m_brandcategory ;}
Set {m_brandcategory = value ;}
}
// Display the number of entries
Int m_listnum = 0;
Public int listnum
{
Get {return m_listnum ;}
Set {m_listnum = value ;}
}
// Sort Fields
String m_orderfield = "ID ";
Public String orderfield
{
Get {return m_orderfield ;}
Set {m_orderfield = value ;}
}
// Where Condition
String m_wherestr = "";
Public String wherestr
{
Get {return m_wherestr ;}
Set {m_wherestr = value ;}
}
String m_text = "";
Public String text
{
Get {return m_text ;}
Set {m_text = value ;}
}
# Endregion
# Region obtain the HTML information of the product list
Public void getlistmsg ()
{
Stringbuilder STR = new stringbuilder ();
Try
{
Ucopration opt = new ucopration ();
Opt. productclass = productclass;
Opt. brandcategory = brandcategory;
Opt. listnum = listnum;
Opt. orderfield = orderfield;
Opt. wherestr = wherestr;
Str. append ("<ul> ");
Ilist list = idbuc. readlist (OPT );
For (INT I = 0; I <list. Count; I ++)
{
Uclist = (uclist) list [I];
String liststr = getcontent ();
If (type = 1)
Liststr = string. Format (liststr, "/product/productdetail. aspx? Id = "+ uclist. ID, uclist. IMG, uclist. productname, uclist. productname, uclist. oldprice, uclist. newprice );
Else if (type = 2)
Liststr = string. Format (liststr, "/product/productdetail. aspx? Id = "+ uclist. ID, uclist. IMG, uclist. productname, uclist. productname, uclist. newprice );
Else if (type = 3)
Liststr = string. Format (liststr, "/product/productdetail. aspx? Id = "+ uclist. ID, uclist. productname );
Str. append (liststr );
}
Str. append ("</ul> ");
}
Catch (exception ex)
{
Str. append (ex. Message );
}
TEXT = Str. tostring ();
}
// Content
Private string getcontent ()
{
If (type = 1)
Return @"
<Li>
<A href = '{0}' target = '_ blank'>
<Div class = 'item'>
{3}
<Label class = 'original-price'> {4} </label>
<Label class = 'special-price'> {5} </label>
</Div>
</A>
</LI> ";
Else if (type = 2)
Return @"
<Li>
<A href = '{0}' target = '_ blank'>
<Div> {3} </div>
<Span> <label class = 'special-price'> {4} </label> </span>
</A>
</LI> ";
Else
Return @"
<Li>
<A href = '{0}' target = '_ blank'> {1} </a>
</LI> ";
}
# Endregion
# Region output product list HTML Information
Protected override void render (htmltextwriter writer)
{
Writer. Write (this. Text. tostring ());
}
# Endregion
Source code call
<Uc1: productlisttag id = "tag1" type = "1" productclass = "-1" brandcategory = "0" listnum = "6" orderfield = "ID" wherestr = "" runat = "Server "> </uc1: productlisttag>