本文整理汇总了C#中DataListItemEventArgs类的典型用法代码示例。如果您正苦于以下问题:C#DataListItemEventArgs类的具体用法?C#DataListItemEventArgs怎么用?C#DataListItemEventArgs使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:list_ItemDataBound
protectedvoidlist_ItemDataBound(objectsender,DataListItemEventArgse)
{
DataRowViewdataRow=(DataRowView)e.Item.DataItem;
stringproductId=dataRow["ProductID"].ToString();
DataTableattrTable=CatalogAccess.GetProductAttributes(productId);
stringprevAttributeName="";
stringattributeName,attributeValue,attributeValueId;
LabelattributeNameLabel;
PlaceHolderattrPlaceHolder=(PlaceHolder)e.Item.FindControl("attrPlaceHolder");
DropDownListattributeValuesDropDown=newDropDownList();
foreach(DataRowrinattrTable.Rows)
{
attributeName=r["AttributeName"].ToString();
attributeValue=r["AttributeValue"].ToString();
attributeValueId=r["AttributeValueID"].ToString();
if(attributeName!=prevAttributeName)
{
prevAttributeName=attributeName;
attributeNameLabel=newLabel();
attributeNameLabel.Text=attributeName+":";
attributeValuesDropDown=newDropDownList();
attrPlaceHolder.Controls.Add(attributeNameLabel);
attrPlaceHolder.Controls.Add(attributeValuesDropDown);
}
attributeValuesDropDown.Items.Add(newListItem(attributeValue,attributeValueId));
}
}
原文链接:
http://www.jxszl.com/biancheng/C/556866.html