Supporters of such legislation say gun-free zones don't work in preventing mass shootings, pointing to a long list of mass killings in gun-free zones across the country.
The bill forces voters who want to affiliate with one of the major parties to register as Republicans or Democrats before the first day for candidates to file to run for office in May.
The bill had passed the House recently on a 51-9 vote, But it was defeated in the Senate Elections, Corporations and Political Subdivisions Committee by a 3-1 margin.