Whenever you create a lead from page layout, you need to edit the properties of layout as Lead Assignment Checkbox - Default [ alone not Show on edit page ] and whenever you create a lead through code, you need to this just before you insert or update lead record.
Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule = true; Database.update(Lead Record, dmo);
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule = true;
Database.update(Lead Record, dmo);
However, Make sure, Lead assignment rule is active and given conditions are correct and the order is as it is supposed.
This will work in all the cases.