Hi everyone,
I have a simple method wich generate a file based on a view (Export.cshtml) to format data.
public ActionResult Export(string searchString, int searchOrder = 0)
{
var user = from m in db.Orders select m;
Response.AddHeader("Content-Type", "application/vnd.ms-excel");
return this.View(user);
}
In the following code, I added a if condition to select a clientID.
public ActionResult Export(string searchString, int searchOrder = 0)
{
var user = from m in db.Orders select m;
if (!String.IsNullOrEmpty(searchString))
{
user = user.Where(s => s.ClientID.Contains(searchString));
}
Response.AddHeader("Content-Type", "application/vnd.ms-excel");
return this.View(user);
}
In this case, in my Index.cshtml view, I enter an ID in a textbox, and when I click on a submit button, it generate a file with only the lines that match this ID.
I would like, when I click the submit button, it retrieves me a file for each clientID in my table, because if I have more than 10.000 clientID, I won't enter an ID and click on submit 10.000 times.
I hope I was clear enough, sorry for my english and thanks in advance for your answers, tips, link, anything... I'm really stuck.