Remove foreach block
protected void DataList4_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "lnkhead")
{
LinkButton lnk = (LinkButton)e.CommandSource;
Label lbl = (Label)e.Item.FindControl("lblhead");
lbl.Visible = true;
lnk.Visible = false;
}
}