A bracket device configured to mount a slide rail to a post, the post having a hole (62a, 62b, 62c), the bracket device comprising: a bracket comprising a first end part, a second end part and an engaging feature, a space being defined between the first end part and the second end part; a base attached to the bracket, the base comprising a rear part and a front part; a mounting member arranged adjacent to the rear part of the base, the mounting member being configured to penetrate through the hole (62a, 62b) of the post to be in rear of the post; and an elastic member; characterized by: a locking member arranged on the bracket and comprising a locking part (39, 202), an operating part (40, 200) and a stopping part, wherein the locking part (39, 202) of the locking member is held to be located at a first position in the space of the bracket in response to an elastic force provided by the elastic member, the operating part (40, 200) configured to be operated to move the locking member relative to the bracket from a first position to a second position, wherein the stopping part of the locking member faces toward the post when the locking member is located at the first position, the stopping part of the locking member does not face toward the post when the locking member is located at the second position; wherein when the operating part (40, 200) of the locking member is not located in the space of the bracket, a front end of the operating part (40, 200) is away from the rear part of the base to be in front of the post; wherein when the locking member is located at the first position, the locking part (39, 202) abuts against the engaging feature; wherein the locking part (39, 202) of the locking member is able to be moved away from the first position in response to operation of the operating part (40, 200) of the locking member; wherein when the front end of the operating part (40, 200) is located adjacent to the base and between the rear part and the front part of the base, the locking member is configured to lock the bracket device to a post when the locking member is located at the first position. a bracket comprising a first end part, a second end part and an engaging feature, a space being defined between the first end part and the second end part; a base attached to the bracket, the base comprising a rear part and a front part; a mounting member arranged adjacent to the rear part of the base, the mounting member being configured to penetrate through the hole (62a, 62b) of the post to be in rear of the post; and an elastic member; a locking member arranged on the bracket and comprising a locking part (39, 202), an operating part (40, 200) and a stopping part, wherein the locking part (39, 202) of the locking member is held to be located at a first position in the space of the bracket in response to an elastic force provided by the elastic member, the operating part (40, 200) configured to be operated to move the locking member relative to the bracket from a first position to a second position, wherein the stopping part of the locking member faces toward the post when the locking member is located at the first position, the stopping part of the locking member does not face toward the post when the locking member is located at the second position; wherein when the operating part (40, 200) of the locking member is not located in the space of the bracket, a front end of the operating part (40, 200) is away from the rear part of the base to be in front of the post; wherein when the locking member is located at the first position, the locking part (39, 202) abuts against the engaging feature; wherein the locking part (39, 202) of the locking member is able to be moved away from the first position in response to operation of the operating part (40, 200) of the locking member; wherein when the front end of the operating part (40, 200) is located adjacent to the base and between the rear part and the front part of the base, the locking member is configured to lock the bracket device to a post when the locking member is located at the first position.