Hi,
I've put a asp:dropdownlist inside a templated column in a ultrawebgrid. I would like to populate dinamically the dropdownlist in C#. How can I do that?
Thanks,
PSC
Hello pedrosacosta,
You can use this code in InitializeLayout() event (or other needed event) in order to get the embedded control and assign needed properties to it:
//create a variable for the templated column in the WebGridTemplatedColumn templatedColumn = (TemplatedColumn) this.UltraWebGrid1.Columns.FromKey("TemplatedColumn");
//get a cellitem reference in the cellitems collectionCellItem cellItem = (CellItem) templatedColumn.CellItems[myRowIndex];
//find the controlControl cs = cellItem.FindControl("<controlID>");
//cast the control into the correct type<ControlType> <name> = (<ControlType>) cs;
<name>.DataSource = ...;
<name>.<property> = ....;
In this way you can access the embedded control and assign values or properties to it.