How to stop Arduino mega 2560 reset when upload program and open serial monitor

I want to know the method to stop Arduino mega 2560 reset when I upload program and open serial
monitor.

1.I tried use a 120 R connect with reset pin and +5v, but is did not work.
2.I tried use a 10uF connect with reset pin and GND, but is did not work.
3.I tried use a 100 R connect with pin 13 (connect with arduino and solenoid) and GND to pull down the Pin 13, but when I power arduino or upload program or open serial monitor, the solenoid still be on and off automatically

I hope the solenoid won't be on until the program ask it to do so.

could anyone help! thanks a lot !

The 10 uF capacitor should have done it. A more permanent solution is to cut the trace connecting the pads labeled "RESET-EN". This disconnects the auto-reset circuit from the Reset pin.

When the Arduino is in reset, all pins act like they aren't connected to anything. If you have an output which must be in a specific state during that period, you must add an external resistor to pull it up or down as required. For a solenoid driven by a MOSFET, a relatively high resistance like 100K is all that's required to put the MOSFET into the correct state.