Does anyone have have information about TemplateAddRow. I have a requirement that specifies that a row should be at the top of the grid and should be used for adding new row with a add button at the last column.
My question is:
1. Do I need to create a TemplateAddRow or one is automatically defined from the datasource? The property does not allow set at runtime but only get?
2. Is it possible to populate a cell of this template from say another control like radiobutton? When a user clicks on the first cell of templateaddrow, a dropdown will appear to allow the user to select a choice and this will further trigger display of group radio button in another control. When a user selects a radio button, it will automatically populate 2 cells in the template and the user can now click add button to add a new row.
lanreiseee said:1. Do I need to create a TemplateAddRow or one is automatically defined from the datasource? The property does not allow set at runtime but only get?
You can use one of three settings to get a TemplateAddRow on top.
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Override.AllowAddNew = AllowAddNew.TemplateOnTop; //e.Layout.Override.AllowAddNew = AllowAddNew.TemplateOnTopWithTabRepeat; //e.Layout.Override.AllowAddNew = AllowAddNew.FixedAddRowOnTop; }
lanreiseee said:2. Is it possible to populate a cell of this template from say another control like radiobutton? When a user clicks on the first cell of templateaddrow, a dropdown will appear to allow the user to select a choice and this will further trigger display of group radio button in another control. When a user selects a radio button, it will automatically populate 2 cells in the template and the user can now click add button to add a new row.
The TempateAddRow is just like a normal row in the grid. It has the same columns and same cells as every other row. You can change the editors in a particular cell, but there's no way to add any extra cells that don't already exist in the data source. Perhaps you could use a ContextMenu to allow the user to select some default settings.
Thanks Mike. I didn't know just setting the property will give me the template. I thought I had to define an UltraGridRow and assign it as the TemplateAddRow. I had also been going through the discussions on TemplateAddRow and i think with your response, I have enough to get going on the task.
You might want to look into the RowEditTemplate feature in addition to the TemplateAddRow. The RowEditTemplate is basically a separate form or control that allows you to edit a row outside the grid. So you could use that to add extra controls that allow the user to pick defaults and such.