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
Hello Anthony,
Thank you for contacting Infragistics Support!We are currently looking into this matter and will keep you posted of any available information.Please do not hesitate to contact us with any updates or additional questions regarding this scenario in the meantime.
Not to keep adding little by little but I just realized this works perfectly with the WebDataGrid.
Please note that on SelectedIndexChanged event of the DropDownList you have to clear the datasource of the grid and rebind it.
As columns adding usually happens on Page load, this is the only way to add a column on other event in the WebHierarchicalDataGrid.
I attach a sample for your reference and please let me know if you have additional questions.
I've got it working now. The difference I think is with this.whdg.GridView.Columns.Add(unboundField1); I wasn't doing the .GridView piece once I had that in there it started working.
Thanks!
thank you for the feedback.
If you need additional assistance regarding this case, please refer to us.
Yana, got a follow up question which should hopefully be simple. I'm using manual crud and trying to updating after each cell change. I've got that pretty much working except when the the RowUpdating event fires and I do my manual updates the grids datasource is being set in the page load with the dataset (like your example has it) and then the grid displays the old info.
Any thoughts or better ways to do this?
<ig:WebHierarchicalDataGrid ID="grdTestResults" runat="server" Height="350px" Width="100%" DataKeyFields="ID" DataMember="Parent" Key="Parent" AutoGenerateBands="False" EnableViewState="False" OnRowUpdating="grdTestResults_OnRowUpdating" AutoGenerateColumns="False"> <Columns> <ig:BoundDataField DataFieldName="TestDateTime" DataFormatString="{0:M/d/yyyy h:mm tt}" DataType="System.DateTime" Key="TestDateTime"> <Header Text="Test Date/Time"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Tech" Key="Tech"> <Header Text="Tech"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="LotNumber" Key="LotNumber"> <Header Text="Lot No"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Line" Key="Line"> <Header Text="Line"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="PartNumber" Key="PartNumber"> <Header Text="Part No"></Header> </ig:BoundDataField> </Columns> <AjaxIndicator Enabled="True" /> <Bands> <ig:Band DataMember="Child" Key="Child" AutoGenerateColumns="False"> <Columns> <ig:BoundDataField DataFieldName="TestDateTime" DataFormatString="{0:M/d/yyyy h:mm tt}" DataType="System.DateTime" Key="TestDateTime"> <Header Text="Test Date/Time"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Tech" Key="Tech"> <Header Text="Tech"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="LotNumber" Key="LotNumber"> <Header Text="Lot No"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Line" Key="Line"> <Header Text="Line"></Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="PartNumber" Key="PartNumber"> <Header Text="Part No"></Header> </ig:BoundDataField> </Columns> </ig:Band> </Bands> <Behaviors> <ig:Activation> <ActivationClientEvents ActiveCellChanged="grdTestResults_Activation_ActiveCellChanged" /> </ig:Activation> <ig:EditingCore AutoCRUD="False"> <Behaviors> <ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="TestDateTime" EditorID="e_DateTimePicker" /> </ColumnSettings> </ig:CellEditing> </Behaviors> </ig:EditingCore> </Behaviors> <EditorProviders> <ig:DatePickerProvider ID="e_DateTimePicker"> <EditorControl runat="server" DisplayModeFormat="g" EditModeFormat="g" DropDownCalendarID="WebMonthCalendar1" EnableAjaxViewState="False"> <AutoPostBackFlags ValueChanged="On" /> </EditorControl> </ig:DatePickerProvider> </EditorProviders> </ig:WebHierarchicalDataGrid>
can you please send me the whole project with the code behind, so that I will be able to investigate the problem with the Manual CRUD?