Hello:
I am currently using WebDataGrid version 10.2.20102.2199 and am wondering if with the WebDataGrid control, it is possible to persist template column controls and values on postbacks and / or callbacks without having to recreate them each and every time in the Preinit event. I have set the EnableViewState and EnableDataViewState flags to true on another project I'm working on and the rows persist but the templated columns lose all textbox and label controls upon postback / callback. I have seen many posts on the web stating that with other controls such as GridView and the like, the columns and controls must be recreated on postbacks / callbacks.
Any input would be appreciated.
Thank you,
Hi Dev__01,
I'm glad that things worked out for you and your implementation was successful. Regarding getting the controls' values at PreInit, as you have pointed out, the values of the controls are not yet parsed in the PreInit event, therefore they are not accessible at that stage of the page life-cycle.
Please tell me if you have further questions.
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support
Hi Peter:
Thank you for your reply. I actually had something like this working a few months back when I initially made the post. The goal at the time was to create a single grid with a certain number of columns based upon user criteria selection at run time. In essence, the number of columns (days in a grid) would depend on what the user selected before submitting the page to dynamically create the columns and then fill the grid with data. Because the column count of the grid depended on user criteria from auto complete boxes and drop down controls, it is not possible to create the columns in the PreInit event because the values from the criteria controls have not yet been parsed by ASP.NET at that point. So the way that I got around the issue was to create five different grids declaratively in the markup code that each fit a specific scenario. Then, when the user makes his / her selections on the page, the appropriate grid will be made visilble and filled with data and all the others will be made invisible. It works quite well. However, if anyone knows of a trick to get the values of form controls at the PreInit event point, I would be interested in knowing in case I get assigned a project in the future where this may be necessary.
Thanks again for your follow up.
Hi Dev_01,
In order to persist your template controls through postback, you would need to create them anew in the PreInit event.
However, there are approaches to keep the values that you had in those controls, should you wish to. The following discussion presents a few ways to achieve that:
http://forums.infragistics.com/forums/p/2995/18532.aspx#17876
The guide for using the ItemTemplate for the templated column can be found at:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1?page=WebDataGrid_Using_Item_Template.html
Please contact me if you have any questions.
Petar Ivanov Developer Support Engineer Infragistics, Inc. http://es.infragistics.com/support