c# - Passing a list of objects between events in a single ASP.NET form from DevExpress -
so have website coded in c#, , when load form, loads several records database , populates grid view. 1 event button click button marked resend. method takes items in grid selected , resend them. if selected items don't follow particular set of rules form pops , says records must moved resend. user has option hit yes , move records or no , continue on business.
i need pass list of selected items resend click yes click on separate form, issue popup , grid technically same form. can load , jazz, load event , of popup's code located in same form.cs grid. haven't been able make event handlers work. create custom eventargs class , store values in there, since 2 forms technically same, i'm not sure how transfer information properly. keep getting null reference exception when try access list of selected values yes click event.
any suggestions should do? properties , variables haven't worked, leads me believe technically 2 different forms, don't know how work them in context.
if need code or want clarified let me know.
store list of selected items in session
cache, this:
protected void buttonresend_click(object sender, eventargs e) { list<items> listofselecteditems = new list<items>(); // put logic here populating listofselecteditems // store listofselecteditems in session cache session["selecteditems"] = listofselecteditems; }
note: made items
class stored in list<t>
; whatever class have holding selected items work or list of string
s.
now in "other" page, can retrieve listofselecteditems
in session
, this:
if(session["selecteditems"] != null) { list<items> listofitems = session["selecteditems"] list<items>; // put logic here work list of selected items }
Comments
Post a Comment