Hi,
I know that we can add a new row to grid in-line by clicking on the button "Add...". But I want to have the detail add row feature where a separate small window pops up, like the UltraGirdRowEditTemplate. Or can I use the same for adding new rows? If yes, please can you provide me a sample code?
Thanks,
Suneela
Suneela,
You should be able to use the AfterRowInsert event for this, such as:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e){ e.Layout.Bands[0].RowEditTemplate = this.ultraGridRowEditTemplate1;}
-Matt
Thanks for the reply Matt!
But actually I did'nt get you. You said, I have to use AfterRowInsert, but the code snippet is having InitializeLayout event. And then, you are just adding the EditTemplate to the grid, but how can it act as an AddRow template?
The reason that snippet is there is that my cerebellum fused and I was otherwise incapable of rational thought, or apparently reading. Or I was spacing out thinking about puppies and rainbows :-) The full snippet of what I meant to do was:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e){ e.Layout.Bands[0].RowEditTemplate = this.ultraGridRowEditTemplate1;}private void ultraGrid1_AfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e){ e.Row.ShowEditTemplate();}
Thanks Matt! It worked.
Now, another problem. I have an unbound column "Edit" in my grid. I want the RowEditTemplate to be displayed only when user clicks on "Add" button or "Edit" button. But, because of its default nature, RowEditTemplate pops up when I click on any of the grid cell. How can I supress this default action? I tried a lot of things, but nothing worked. Please can you suggest me any idea?
If you only ever want to show the template when you are programmatically calling it, you should set the RowEditTemplateUIType to None on either the DisplayLayout.Override or the band's Override.
Thanks Matt! It Worked!
Suneela.