I'm trying to get the current item for filter search value. When im trying to access the RenderingContext.Current.Rendering.Item
it showing some kind of error. Please find my screen shot below.
1. I'm Getting error because of postback in case if it is, How to resolve this without ajax?
Error Message:
System.InvalidOperationException
HResult=0x80131509
Message=Attempt to retrieve context object of type 'Sitecore.Mvc.Presentation.RenderingContext' from empty stack.
Source=Sitecore.Mvc
StackTrace:
at Sitecore.Mvc.Common.ContextService.Peek[T]()
at Molina.Project.Microsites.Web.Controllers.MicroSites.HopeLocationDropOff.LocationDropOffController.GetLocationInfo(String SearchString) in C:\Molina\Mohamed\Project\Microsites\Molina.Project.Microsites.Web\Controllers\MicroSites\HopeLocationDropOff\LocationDropOffController.cs:line 23
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2()