or
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" AllowAutomaticUpdates="true" OnNeedDataSource="RadGrid1_NeedDataSource" OnCreateColumnEditor="RadGrid1_CreateColumnEditor"> |
protected void RadGrid1_CreateColumnEditor(object sender, GridCreateColumnEditorEventArgs e) |
{ |
if (e.Column is GridBoundColumn) |
{ |
if ((e.Column as GridBoundColumn).DataField == "Code") |
{ |
DropDownList ddl = new DropDownList(); |
e.ColumnEditor = new CustomDropDownList(ddl); |
} |
} |
} |
public class CustomDropDownList : GridTextBoxColumnEditor |
{ |
private DropDownList _ddl; |
public CustomDropDownList(DropDownList ddl) |
{ |
this._ddl = ddl; |
} |
protected override void LoadControlsFromContainer() |
{ |
this._ddl = this.ContainerControl.Controls[0] as DropDownList; |
} |
public override bool IsInitialized |
{ |
get |
{ |
return this._ddl != null; |
} |
} |
public override string Text |
{ |
get |
{ |
return this._ddl.SelectedValue; |
} |
set |
{ |
this._ddl.SelectedIndex = this._ddl.Items.IndexOf(this._ddl.Items.FindByValue(value)); |
} |
} |
protected override void AddControlsToContainer() |
{ |
this.ContainerControl.Controls.Add(this._ddl); |
} |
} |
DataRepeater.ID = String.Format(
"DR{0}"
, ItemID);
DataRepeater.DataSource = oToDoList;
DataRepeater.DataBind();
foreach
(RepeaterItem RItem
in
DataRepeater.Items)
{ ... }
pnlNiches.Controls.Add(DataRepeater);
Repeater DataRepeater = (Repeater)pnlNiches.FindControl(String.Format(
"DR{0}"
, ItemID));
if
(DataRepeater !=
null
)
{
foreach
(RepeaterItem RItem
in
DataRepeater.Items)
{ ... }
}