예제 #1
0
        protected void uiRepeaterDir_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView row = (DataRowView)e.Item.DataItem;
                int catid = Convert.ToInt32(row["CategoryID"].ToString());

                SubCategories sub = new SubCategories();
                sub.GetAllSubCategoriesByCategory(catid);

                Literal subs = (Literal)e.Item.FindControl("uiLiteralSub");

                if (sub.RowCount > 0)
                {
                    subs.Text = "<ul>";
                    for (int i = 0; i < sub.RowCount; i++)
                    {
                        subs.Text += "<li><a href=\"/Directory.aspx?cid=" + catid.ToString() + "&scid=" + sub.SubCategoryID.ToString() + "\" >" + sub.ArName + "</a></li>";
                        sub.MoveNext();
                    }
                    subs.Text += "</ul>";
                }
            }
        }