I'm trying to add a AutoPostBack enabled RadComboBox to the ItemTemplate of a RadGrid's GridTemplateColumn. The RadComboBox relies on certain row data so I'm creating it dynamically using the grid's ItemDataBound event:
Here is a snippet of my custom overridden WorkflowComboBox:
Like I said, this works perfectly fine on the initial page load. The problem occurs on the AutoPostBack of the ComboBox. This causes a postback which doesn't appear to be firing the ItemDataBound event again. That in turn causes my the Combobox field to not be loaded properly.
I've also tried moving the ItemDataBound stuff to the RadGrid's ItemCreated event instead. Everything works fine on first page load. When the ComboBox AutoPostBack gets fired though, the e.Item.DataItem is null.
I'm getting the vibe that this is an issue/conflict? with the event sequence of the RadGrid and the RadComboBox. It also appears during this whole process that the RadComboBox SelectedIndexChanged event is never being reached.
Any thoughts? Am I missing something!?
-Thanks
protected void rgFaqs_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e){ if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem) { FaqListItem item = (FaqListItem)e.Item.DataItem; if (item == null) return; WorkflowComboBox workflowBox = new WorkflowComboBox(); workflowBox.ItemID = item.Id; workflowBox.DataBind(); PlaceHolder phWorkflowBox = (PlaceHolder)e.Item.FindControl("phWorkflowBox"); phWorkflowBox.Controls.Add(workflowBox); }}Here is a snippet of my custom overridden WorkflowComboBox:
public class WorkflowComboBox : Telerik.Web.UI.RadComboBox { public int ItemID { get; set; } public WorkflowComboBox() { AutoPostBack = true; } protected override void OnInit(EventArgs e) { this.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(WorkflowComboBox_SelectedIndexChanged); EnsureChildControls(); base.OnInit(e); }Like I said, this works perfectly fine on the initial page load. The problem occurs on the AutoPostBack of the ComboBox. This causes a postback which doesn't appear to be firing the ItemDataBound event again. That in turn causes my the Combobox field to not be loaded properly.
I've also tried moving the ItemDataBound stuff to the RadGrid's ItemCreated event instead. Everything works fine on first page load. When the ComboBox AutoPostBack gets fired though, the e.Item.DataItem is null.
I'm getting the vibe that this is an issue/conflict? with the event sequence of the RadGrid and the RadComboBox. It also appears during this whole process that the RadComboBox SelectedIndexChanged event is never being reached.
Any thoughts? Am I missing something!?
-Thanks