Some laptops are set up that way. Try turning off the laptop (not sleep or hibernate, but off) and see if it will charge then.
If not, then either the battery you got isn't right for your device. If it is an aftermarket battery that is completely possible. Or, your charging circuit might be bad.
However if it will charge when turned off, just not when turned on, then it is the charging cord that needs replacing. If they are damaged (even if you can't see it) they can be not allowing enough power to get through and both power the device and charge the battery.
If it doesnt charge at all, or says its charged and dies immediately. I had a similar problem, you have to open the laptop, get access to the motherboard and desolder the thing where you plug in the charger, buy a new one (pretty cheap) and solder the new one on. This WILL void ALL warranty and should only be done if you have replaced the battery and the power supply and the same problem persists.