You are changing the id of control, which probably is not required, and lster accessing the control with the old id. you would use NavURL
instead of divIcon
. You better store the divIcon in some object and later use it.
HtmlGenericControl htmlGenericControl = ((HtmlGenericControl)e.Item.FindControl("divIcon")).ID = NavURL;
if (secondFirstRun)
{
htmlGenericControl .Attributes.Add("class", "active tab-pane overflow-auto");
}