troubleshooting Question

Static method and TempData, what is another alternative?

Avatar of Stacie
StacieFlag for United States of America asked on
.NET ProgrammingC#
4 Comments4 Solutions192 ViewsLast Modified:
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 ...
                {

}.....
ASKER CERTIFIED SOLUTION
Kyle Abrahams
Director of Information Technology

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 4 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros