I've got a simple webhierarrchicaldatagrid and I'm trying to add columns dynamically to it after a dropdownlist is selected. No matter what I do I can only add columns to the grid from the initial page load. Is it possible to do this or is there a re-render I need to call after adding the columns?
Thanks
I was able to get this working. I turned off all the auto-postback and just added a client side CellValueChanged which just commits the changed and this seems to be more consistant.
function grdTestResults_Editing_CellValueChanged(sender, eventArgs) { var row = eventArgs.get_cell().get_row(); if (row.get_index() != -1) { var webDataGrid = $find('<%=grdTestResults.ClientID %>').get_gridView(); if (webDataGrid.get_rows().get_length() > 0) { var editingCore = webDataGrid.get_behaviors().get_editingCore(); editingCore.commit(); } } }
Hi Yana, got another question for you; by just adding wddProvider.EditorControl.AutoPostBackFlags.ValueChanged = Infragistics.Web.UI.AutoPostBackFlag.On; to your sample when adding the dropdownprovider i'm getting a view state error.
My end result would be that when the dynamic dropdownprovider valuechanged it would postback and get into the rowupdating event. The idea behind this is when any cell is changed it will save an audit record to have a detailed history of changes (which is being displayed in the child table).
Thanks again, that was it. I forgot the .GridView and then I was able to get the dropdown to work with one small change to your example; I had to move the .DataBind() after setting the field names. If I did databind before it would just should the object.tostring() value like "system.data.datarowview"
Hello Anthony,
as to the first question about the updating, re-querying the data, clearing the datasource and reseting is a good way for doing that.
I modified the sample, as I added a DropDownProvider and it works properly in this scenario. I guess that the problem in your code could be the missed Gridview, which comes with the WebHieararchicalGrid behaviors and EditorProviders. If you need additional information, please contact us.
I will need some time to research this and I will let you know about the solution as soon as possible.