views:

75

answers:

1

As the itemcommand event fires after most if not all page/control init/load events. what is the best way to persist session variable data that is modified on itemcomment (adding items for example) so that the page can react to the itemcommand using the modified session?

A: 

You could catch the postback earlier in the page's lifecycle:

// id of the control
   string id = Request.Form["__EVENTTARGET"];  

   if (!string.IsNullOrEmpty(id) && id.Contains("myControlId"))  
   {
        string argument = Request.Form["__EVENTARGUMENT"];
        ...
   }

but it's neither very elegant nor safe. I would follow the suggestion of Skowronek: to put more logic on PreRender.

onof