Circuit for opening/closing sprinkler valve solenoid?
Yes, you need the 24 V transformer to start with. We often use transistors as switches to switch loads from a microcontroller, but transistors can't be used to switch AC, and then there's the relay, either an electromechanical one, or a solid state relay (SSR), which uses a triac as switching element.  

Most electromechanical relays can't be controlled directly from your Arduino, and need a transistor to increase the current.



The relay shown uses 12 V, which is a common value, and you might have 12 V available for powering the Arduino. But there are also 5 V relays, which you can power from the Arduino's 5 V power supply. Note that many 5 V relays will require more current, and that the Arduino's voltage regulator is limited to 800 mA; you may need the 5 V for other applications too. The 5 V version of  this relay, however needs only 15 mA and can driven directly by Arduino's outputs.
An advantage of the relay is that its contacts have a low on-resistance and a negligible voltage drop.

The SSR is has no moving parts and therefore a longer life. It's often more compact than an electromechanical relay. 

 

It needs less current to drive it, and since it requires less than 1.5 V you can usually control it directly from a microcontroller's output. Just place a 180 &Omega; resistor in series with the SSR's LED. If the microcontroller can't supply the SSR's 20 mA you still have to use the transistor the same way as for the electromechanical relay.
SSR's have a voltage drop across their switching triac, for this SSR 1.5 V is specified. That will cause some power losses, but for a 300 mA solenoid this will only be half a watt. Most likely the solenoid will also work at the remaining 22.5 V AC.