I've tried the usual way of:
var form = new FormCollection { "WeekList" = weekfilter, "PracticeList" = practicefilter}
and all possible deviations I could think of, but ultimately had to seperate it apart as:
var form = new FormCollection();
form["WeekList"] = weekfilter;
form["PracticeList"] = practicefilter;
How can I initialize this inline? Is it possible? (I'm basically trying to mimic a form being submitted)
If you're using ASP.NET MVC (not core), you can initialize System.Web.Mvc.FormCollection
like this:
var form = new FormCollection {
{"WeekList", weekfilter},
{"PracticeList", practicefitler}
}
But I'm not the right computer to test this. I'm basing this on the .Add
method of FormCollection begin declared as:
public virtual void Add(
string name,
string value
)
What types are the filter variables declared as?