I have the following javascript function:
{
activeRow.editRow();
}
And following code behind:
UltraWebGrid1.Bands[0].RowEditTemplate = template;
UltraWebGrid1.Bands[0].CellClickAction = Infragistics.WebUI.UltraWebGrid.CellClickAction.CellSelect;
When page is first loaded, clickign on a button on the grid invokes the RowEdit template correctly, however on a postback clicking on the button again calls ClickCellButton function however it looks like editRow simply doesn't show the RowEdit template anymore.
Any ideas?
Thanks,
Hello,
This appears to me to be a page lifecyle events issue, I can suggest a few things which you may try.
The first suggestion is to use the InitializeDataSource event of the grid and move your code there (both the declarative assigning of the row template and the databinding). TBecause the grid requires data at different points during the page lifecycle according to the features being used, there isn't one place where data can be bound. Page_load may be late in other cases. Because of the strict requirements the grid has on when it needs data, the InitializeDataSource event is how the Grid will request data. In this event, you must assign the grid's datasource (and be sure if it's a dataset, it has data in it). You don't need to call DataBind, just setting the datasource is enough in this event. Make sure you rebind in all cases, not only when Postback is false.
The second suggestion you may try is to move the code fom Page_Load, to OnInit and rebind in all cases (not only when Page.IsPostBack is false).After postback, the grid needs to restore its state from ViewState, this happens between Init and Load, so setting datasource and row template there may work out better in postback scenarios.
Rumen moving the code from Page_Load to InitializeDataSource event appears to have fixed the RowEditTemplate issue, however now I have another issue.
I had the following code in inside of InitializeLayout event:
UltraWebGrid1.Columns.Add(InfragisticsHelper.GetCustomUpdateColumn());
Which now is causing for dupplicate sets of those 2 columns to be added on each postback including initial load of the page. I fixed that by moving that code inside of InitializeDataSource and wrapping them inside of a (ispostback) conditional statement. Is that the best approach?
UltraWebGrid1.DataBind();
Thanks again for your help