We help IT Professionals succeed at work.

Static method and TempData, what is another alternative?

Stacie
Stacie asked
on
176 Views
Last Modified: 2018-11-28
I'm trying to find  a way to pass  a TempData from a static method to another method but I'm having some issue finding the correct answer to this problem bellow, since I can't use a TempData in a static field..

   
 public static XtraReport BuildReportObject(DailyEmployeeRecapSearchCriteria searchCriteria)
        {
           var resultsContainer = GetReportResults(searchCriteria)
           TempData['"value"] = resultsContainer;  I can't do this, since its a static field.
          ........

          return SetDefaultsForReportObject(mainReport, .....
        }

why I wanted to use a TempData so that I could use it into another method.

 public FileResult ExportCsvFormat(string dataSource)
        {
  foreach (var x in (List<GroupBillingCustomerDetails>)TempData["GroupBillingdata"])  > Then here I can use my TempData ...
                {

}.....
Comment
Watch Question

Fernando SotoRetired
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Senior .Net Developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Fernando SotoRetired
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2015
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION