This paper studies the networked control systems (NCSs) with bilateral time-varying delay and packet dropout, and proposes a novel active time-varying sampling period switched control method to make the system stable. Firstly, the event and time-driven sensor is adopted, and its variable sampling period is designed to follow the change of time delay and packet dropout simultaneously. Then the discrete-time switched systems with uncertain parameters are modeled by using the method of augmented matrix, and the condition satisfying exponential stability of the system state is obtained based on the approach of average dwell time. The obtained condition further establishes the quantitative relation between the exponential decay rate and the packet dropout rate. This method overcomes the problem of long delay and packet disordering in NCSs. Finally the simulation result illustrates the effectiveness of the proposed method.