I can't seem to work out why an instance of an object isn't getting created when I create it in a sub routine.
In Page_Load if i have this:-
Without the lines in red, I get "instance of an object" error. If I create the instance in the page load I don't get the error.Code:private Order order; protected void Page_Load() { if(!ispostback) { buildOrderItemList(ActionChoice.Build); order = new Order(); order.orderItems = new List<Product>(); order.id=-1; this.dlstOrderItems.DataSource=Order.orderItems; this.dlstOrderItems.DataBind(); } } protected void buildOrderItemList(Action) { Order order = new Order(); order.orderItems = new List<Product>(); . . . }
I use a similar technique with another Data List and it works fine.
Can't work out why the instance isn't working in the void.
Any ideas?



LinkBack URL
About LinkBacks
Reply With Quote


Bookmarks