Grand Secretariat
Ding was born in Shanyang (present-day Huai'an), Jiangsu province. Although not awarded an official post, he was an important figure in the defense of Shanyang from the British in 1842, during the First Opium War. He also helped to rebuild the city's walls after the attack. As a result, he was appointed secretary of the Grand Secretariat in 1843.