Hello. I would like to embed a user control that uses a RadGrid control inside a RadComboBox so that the control displays when the user clicks the dropdown. I would then like to use this RadComboBox in a GridTemplateColumn inside another RadGrid. I'll include the markup below.
ucCaseworkerList has a public load method, which I call in the grid's ItemDataBound event handler as follows.
The problem with the above code is that nestedView always turns out to be null. In addition, I'm concerned that this code may prove to be too slow, and thus cause server timeouts. I'd appreciate any advice you can offer.
<tel:GridTemplateColumn HeaderText="Assign To" UniqueName="AssignTo" AllowFiltering="false"> <ItemTemplate> <tel:RadComboBox id="rcAssignTo" runat="server"> <ItemTemplate> <uc:CaseworkerList ID="ucCaseworkerList" runat="server" DisplayMode="CaseTransferAssign" OnAssignToCaseworker="ucCaseworkerList_AssignToCaseworker" /> </ItemTemplate> </tel:RadComboBox> </ItemTemplate></tel:GridTemplateColumn>ucCaseworkerList has a public load method, which I call in the grid's ItemDataBound event handler as follows.
/// <summary>Handles rgActiveCases' ItemDataBound event by getting the CaseProgramUser/// and AgencyProgram keys, finding the CaseworkerList control embedded in/// the GridTemplateColumn's combobox, and calling its load method.</summary>////// <param name="sender">Source of the event.</param>/// <param name="e"> Grid item event information.</param>protected virtual void rgActiveCases_ItemDataBound(object sender, GridItemEventArgs e){ if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { var item = e.Item as GridDataItem; var cpuKey = (int)item.GetDataKeyValue(Constants.EntityKeys.CASE_PROGRAM_USER_KEY); var apKey = (int)item.GetDataKeyValue(Constants.EntityKeys.AGENCY_PROGRAM_KEY); var dropDown = item.FindControl("rcAssignTo") as RadComboBox; if (dropDown != null) { var nestedView = dropDown.FindControl("ucCaseworkerList") as CaseworkerList; if (nestedView != null) { nestedView.LoadCaseworkerList(apKey, cpuKey); } } }}The problem with the above code is that nestedView always turns out to be null. In addition, I'm concerned that this code may prove to be too slow, and thus cause server timeouts. I'd appreciate any advice you can offer.