I have a webgrid and add my columns in code-behind. I also have a WebCombo on my page (in the markup) which I would like to add as an EditorControl to one of my columns.. So my problem is that I need to add this EditorControl in code-behind when I create my columns.
I assume that I should do something like
newColumn = new UltraGridColumn("myKey", "myHeader", ColumnType.Custom, "");
newColumn.EditorControlID = myWebCombo.ID;
Correct? I tried doing this but the webcombo is not attached to the column, instead the WebCombo is just displayed on the page outside the grid. I am not sure that the ID is correct.. I tried using ClientID aswell, but doesn't work neither. Any thoughts on this?
Hello,
We have found a resolution for your issue, please check the code below:
//Create a WebCombo
WebCombo combo = new WebCombo("webComboID");
//Add a combo to the Form container.
this.Page.Form.Controls.Add(combo);
//Configure the column.
UltraWebGrid1.Columns[1].Type = ColumnType.Custom;
//The Unique ID is required if you use MasterPages.
UltraWebGrid1.Columns[1].EditorControlID = combo.UniqueID;
Let me know your feedback.
Thank you very much! :)
Just to let you know I run in to the same issue.
I will investigate it further and I will inform you.
That is, I want the grid control to be independent of the page. If I add the web combo in the mark up, the grid depends on the page having a webcombo and I don't want it like that. I want a more object oriented solution, where the grid handles its columns and their editor controls by itself.
Thanks for helping out!
I have tried this approach earlier and it works fine, but the case is that I want the web combo to "belong" to the grid control, not the page. Can it be done?