Hello tanya2728.
Thank you for using Apple Support Communities. It sounds like you have an issue with having your Wi-Fi switch greyed out. We can understand how this would be an issue. Allow us to investigate this issue and assist in any way we can.
A great troubleshooting step to attempt, would be to update your iOS version. This can sometimes help. However, you did mention that you get an error when trying. If you're getting an error, we have a couple of helpful resources you can review for steps you can try in order to get your device updated:
If you see an error when you update or restore your iPhone, iPad, or iPod - Apple Support
iOS update and restore errors - Apple Support
If your iPhone, iPad or iPod touch won’t update - Apple Support
If you have access to a different computer, you might want to try updating using that computer. Another step that you can do to troubleshoot your greyed out Wi-Fi switch, would be to reset your Network Settings. To reset your Network Settings. Tap Settings > General > Reset > Reset Network Settings. This also resets Wi-Fi networks and passwords, cellular settings, and VPN and APN settings that you’ve used before. Your iPhone will restart during this task. After it does, check to see if that helps.
If updating and resetting your Network Settings don't help, please reach out to Apple Support for help. You can reach them by using the link below:
Get Support
We hope this information is useful. Best of luck.