I'm not sure if I'm posting in the right place....
We're using KendoUI MVC with the help wrappers.
I have a simple page created in MVC using KendoUI.
The controller sets the value of a global variable "SomeValue" on initialization, but what I don't understand is when I use AJAX binding to bind data from the controller to the grid, why when "GetData()" is called it is unable to see the value of "SomeValue" or even the value of ViewBag.Heading.
When GetData() is called its almost as if the function is being called in isolation and doesn't know anything about the anything else in the controller....
What I wanted to do was when the Index controller is called, load all my data from my database into a global variable, so when "GetData()" is called it doesn't have to reload the data from the database, it can use the data that is set to the variable "SomeValue"....
How do you do this in KendoUI?
Here is a snippet of code of what I'm trying to do....
Controller
--------------
public string SomeValue;
public ActionResult Index(string strClient, string strProductType, string strCloseOfBusinessDate)
{
ViewBag.Heading = "DV01";
SomeValue = "Hello there!";
return View();
}
public ActionResult GetData(string strClientName, string strDate)
{
return Json(Graph.GraphData(SomeValue, strClientName, strDate));
}
We're using KendoUI MVC with the help wrappers.
I have a simple page created in MVC using KendoUI.
The controller sets the value of a global variable "SomeValue" on initialization, but what I don't understand is when I use AJAX binding to bind data from the controller to the grid, why when "GetData()" is called it is unable to see the value of "SomeValue" or even the value of ViewBag.Heading.
When GetData() is called its almost as if the function is being called in isolation and doesn't know anything about the anything else in the controller....
What I wanted to do was when the Index controller is called, load all my data from my database into a global variable, so when "GetData()" is called it doesn't have to reload the data from the database, it can use the data that is set to the variable "SomeValue"....
How do you do this in KendoUI?
Here is a snippet of code of what I'm trying to do....
Controller
--------------
public string SomeValue;
public ActionResult Index(string strClient, string strProductType, string strCloseOfBusinessDate)
{
ViewBag.Heading = "DV01";
SomeValue = "Hello there!";
return View();
}
public ActionResult GetData(string strClientName, string strDate)
{
return Json(Graph.GraphData(SomeValue, strClientName, strDate));
}