how to disable a button (that is found in a view) from a method in a controller ?

Recommended Answers

All 3 Replies

the button should have an enabled property just set it to false

But I'm working with mvc !

Generally speaking if the button is in the view then it should be accessed by the code in the view. The idea of the controller is to separate the view from the model. To access the button from the controller, try incorporating the button into the model, and have the controller access it there. If you must insist on having the controller access the view, qualify the button by the class in the view that contains the button. Or have the controller return a boolean that you can use in the view to set the .Enabled property of the button.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.