Please use appropriate formatting tags when posting code for the sake of readability:
csharp Code:
public void FillProduct()
{
ProductsMN productsMN = new ProductsMN();
if (dlBook == null)
{
dlBook = new DataList();
dlBook.DataSource = productsMN.GetByCategoryName(CategoryName);
dlBook.DataBind();
}
else
{
dlBook.DataSource = productsMN.GetByCategoryName(CategoryName);
dlBook.DataBind();
}
}
public string CategoryName { get; set; }
csharp Code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
string categoryName = Request.QueryString["categoryName"] as string;
if (!string.IsNullOrWhiteSpace(categoryName))
{
BookContent.Controls.Clear(); // BookContent : Placeholder
Control c = Page.LoadControl("~/UC/UC_Books.ascx") as UC.UC_Books;
UC.UC_Books ucBook = new UC.UC_Books();
ucBook.CategoryName = categoryName;
ucBook.FillProduct(); //line 10
BookContent.Controls.Add(ucBook); //line 11
}
}