I have a Default.aspx, it has it’s code behind, Default.cs.aspx.
I have a variable in the Default.cs.aspx
public DataSet AllProducts { get; set; }
In the Page_Load function I have it getting all these products from a table, assign it to AllProducts, and I use Page.DataBind(); to apparently bind the variable to the page.
However in the page when i do this:
<% foreach(DataRow product in AllProducts) { %>
it doesn’t like AllProducts, doesn’t exist in this current context . . . .
Now, I would like two answers.
The first, how do I get access the AllProducts variable?
The second, is it safe to do the data pull inside the aspx page and assign all variables inside the aspx page, if so how?
Thanks
To answer the problem I have been having is to access variables from codefile in the aspx page.
I wasn’t forming the syntax correct.
This is what i have been trying
This is what it should have looked like, note the space!
Unfortunately this asks another question, how do I then put that into a variable for the page, because you can’t stick that line into the property NavigateUrl in the asp:HyperLink control.
What I’m trying to do now is view the product on another page, so I need to push the productID to that page somehow.