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,
I think you need to set the type of the column like this
column.Type = ColumnType.Custom;
Regards,
Rado
I made a mistake in my previous post. The WebCombo is not displayed on the page outside the grid, instead it simply disappears.
Anyway, with Rado's suggestion I changed my code to:
newColumn = new UltraGridColumn();
newColumn.Key = "myKey";
newColumn.Type = ColumnType.Custom;
The result is the same! I am able to populate the column with values but there is no WebCombo control in the cells.
Just to let you know I run in to the same issue.
I will investigate it further and I will inform you.
Thank you very much! :)
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.
Yes, I have just tired it. Now the webcombo actually appears on the page, but not inside the grid control :(
From the grid control I am now creating a webcombo and adding it to the page's form:
this.Page.Form.Controls.Add(myWebCombo);
I use a master page, so I am adding the webcombo to the column this way:
myColumn.EditorControlID = myWebCombo.UniqueID;
Any other ideas?
can you attach your markup here please.
Thanks.