Determine DDL value for creating dynamic columns in oninit event
Hello, hopefully there is a simple solution to this complex problem. Please correct any misconceptions I have along the way. A while ago I wrote a GrivView with dynamic column capability. The columns are added to the page's OnInit event, so they are added before the viewstate is applied. They are reapplied to every post in that section of the page so that when the application viewstate is used, the changes made by the user and not tied to the database are preserved. This is also necessary if you don't want your view's control tree to show up due to synchronization and blow everything up.
My current problem is that I am now instructed to do essentially the same thing, that the columns will differ depending on the dropdown (I will recreate the GridView if the ddl changes and users lose all work with the warning). How can I get the ID that is selected in the dropdown in the OnInit event? My understanding is that when the user changes the ddl value on the client side, a JavaScript call "__doPostBack" is triggered. The page request is then sent to the server, but by the time the new value appears in the event handler, I am past the point where I need to add columns.
I saw something that I thought was promising when people were trying to figure out what kind of control a post caused, but that code is page dependent. Request.Params.Get ("__ EVENTTARGET"); and page.Request.Form, which are empty.
Should I look at the session state, try "send id using client side processing" or some other method (maybe a hidden view in the view that is missing)?
Thanks for any ideas !!!
a source to share