I am working with a datalist on one of my pages, while trying to find the controls using a foreach loop it does not go into the loop.
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
foreach (DataListItem dli in shoplistview.Items)
{
string productID = ((Label)dli.FindControl("lblProductID")).Text;
}
}
}
Is the datalist not in the current runtime when !IsPostBack? Or is there something I am missing here? If you need any additional info I can try to include it. I appreciate any advice you can offer to me. Thank you for your time.
Bind Datalist[shoplistview] before the for Loop