in my asp page from the C# code behind. While I can get at it by ID in the main Page_Load section, I cannot access it from a function on the page, which is where I want to do the work.
My div:
<div id="searchParams" modifiedstring="This is a Test" runat="server"></div>
In the C# code-behind I am trying to access it from this function:
public static void getItemsBySubject(string search)
{
List<HeritageItems> ItemList = DataAccess.FindItemsBySubject(search);
string modifiedstring = Jsonify(ItemList);
*I Want to access searchParams here but cannot*
}
I get an "object reference is required for the non-static field, method, or property" error
However I can access it just fine here on the same code behind page:
protected void Page_Load(object sender, EventArgs e)
{
searchParams.etcetera
}
What I have tried:
I'm obviously a beginner in this so I could be missing something very obvious. All the help pages I've seen online for similar questions show the example in the Page_Load function. Which makes me think that has something to do with it....
But I suspect (hope) there is a way of accessing this from another stand alone function that I will call from another page. When working in console apps this might require an object to be instantiated, but my attempts at trying a few different methods haven't worked because the
id is simply not accessible to even use in a statement.
Any suggestions would be appreciated.