Show a list of all orders placed by the current customer on the Order Edit page.
Insert C#/VB.NET code snippet on the Page Designer screen:
dynamic tblOrders = GlobalVars.dal.Table("Orders");
var rs = tblOrders.Query(String.Format("OrderID={0}", MVCFunctions.postvalue("editid1")), "");
var data = CommonFunctions.db_fetch_array(rs);
var CustomerID = data["customerid"];
MVCFunctions.Echo(String.Format("Orders placed by {0} <br>", CustomerID));
var rsOrders = tblOrders.Query(String.Format("customerid='{0}'", CustomerID), "");
while(data = CommonFunctions.db_fetch_array(rsOrders))
{
MVCFunctions.Echo(
String.Format("<a target=_blank href='{0}'>{1}</a> {2}<br>",
MVCFunctions.GetTableLink("Orders", "edit", String.Format("editid1={0}", data["OrderID"])),
data["OrderID"], data["OrderDate"]));
}
See also:
•Master-details relationship between tables