private void LoadList() { Int64 PromoBySupplierID = Convert.ToInt64(lblPromoBySupplierID.Text); PromoBySupplierItems clsPromoBySupplierItems = new PromoBySupplierItems(); lstStuff.DataSource = clsPromoBySupplierItems.ListAsDataTable(PromoBySupplierID).DefaultView; lstStuff.DataBind(); clsPromoBySupplierItems.CommitAndDispose(); }
private void lstItem_ItemDataBound(object sender, DataListItemEventArgs e) { if(e.Item.ItemType == ListItemType.Header) { LoadSortFieldOptions(e); } else if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dr = (DataRowView) e.Item.DataItem; HtmlInputCheckBox chkList = (HtmlInputCheckBox) e.Item.FindControl("chkList"); chkList.Value = dr["PromoBySupplierID"].ToString(); Label lblPromoBySupplierCode = (Label) e.Item.FindControl("lblPromoBySupplierCode"); lblPromoBySupplierCode.Text = dr["PromoBySupplierCode"].ToString(); Label lblPromoBySupplierName = (Label) e.Item.FindControl("lblPromoBySupplierName"); lblPromoBySupplierName.Text = dr["PromoBySupplierName"].ToString(); Label lblPromoLevel = (Label)e.Item.FindControl("lblPromoLevel"); lblPromoLevel.Text = ((PromoLevel) Enum.Parse(typeof(PromoLevel), dr["PromoLevel"].ToString())).ToString("G"); Label lblStartDate = (Label) e.Item.FindControl("lblStartDate"); lblStartDate.Text = Convert.ToDateTime(dr["StartDate"].ToString()).ToString("MM/dd/yyyy HH:mm:ss"); Label lblEndDate = (Label) e.Item.FindControl("lblEndDate"); lblEndDate.Text = Convert.ToDateTime(dr["EndDate"].ToString()).ToString("MM/dd/yyyy HH:mm:ss"); Label lblStatus = (Label) e.Item.FindControl("lblStatus"); PromoBySupplierStatus Status = (PromoBySupplierStatus) Enum.Parse(typeof(PromoBySupplierStatus), dr["Status"].ToString()); lblStatus.Text = Status.ToString("G"); Int64 PromoBySupplierID = Convert.ToInt64(dr["PromoBySupplierID"].ToString()); DataList lstStuff = (DataList) e.Item.FindControl("lstStuff"); PromoBySupplierItems clsPromoBySupplierItems = new PromoBySupplierItems(); DataClass clsDataClass = new DataClass(); lstStuff.ItemDataBound += new System.Web.UI.WebControls.DataListItemEventHandler(this.lstStuff_ItemDataBound); lstStuff.DataSource = clsPromoBySupplierItems.ListAsDataTable(PromoBySupplierID).DefaultView; lstStuff.DataBind(); clsPromoBySupplierItems.CommitAndDispose(); //For anchor HtmlGenericControl divExpCollAsst = (HtmlGenericControl) e.Item.FindControl("divExpCollAsst"); HtmlAnchor anchorDown = (HtmlAnchor) e.Item.FindControl("anchorDown"); anchorDown.HRef = "javascript:ToggleDiv('" + divExpCollAsst.ClientID + "')"; } }