I have a method in the controller which returns a string.
I need to call this method from my view to get the string and show in the view.
I am using MVC2. how can i call a public method in controller from the View?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You really shouldn’t be calling a method in the controller from the view, that’s backwards from the MVC pattern. Controllers call views. You could either pass in the data to the view from the controller as it’s called, or this might be a method that belongs in a helper class the view can use.
Edit: Good starter tutorial on helpers if you aren’t familiar.