Solved

Mvc 3  : How to return a variable from a method  to an action result and dispay in view.

Posted on 2013-06-23
4
465 Views
Last Modified: 2013-06-25
I will like to pass a variable "totalCount" from a method to an ActionResult index view. I will like to show the variable in a text area in the view. How can I achieve this ? My code is attached.
I am using mvc 3
Question.txt
0
Comment
Question by:Sirdots
  • 2
4 Comments
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 39272272
Hi,

You can try using ViewBag. Unfortunately, i'm not able to give you the code for it!

You can refer this article - http://rachelappel.com/when-to-use-viewbag-viewdata-or-tempdata-in-asp.net-mvc-3-applications

Hope it helps u...
0
 

Author Comment

by:Sirdots
ID: 39274294
I've requested that this question be deleted for the following reason:

No good answer.
0
 
LVL 11

Accepted Solution

by:
Mihai Stancescu earned 500 total points
ID: 39273807
Hi,

If you're using the code that you have attachet than you can get the totalCount in the Index() action and you can pass it to the model via ViewBag, create a custom viewmodel with that property in it and then in the view use the property like any other model bindings.



Regards,
Mishu
0
 

Author Comment

by:Sirdots
ID: 39274296
Thanks
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question