This is a migrated thread and some comments may be shown as answers.

Embedding a user control incorporating a RadGrid inside a RadCombo, which is in turn embedded in a RadGrid GridTemplateColumn

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew Graybosch
Top achievements
Rank 1
Matthew Graybosch asked on 31 Mar 2011, 05:16 PM
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.

<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.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 05 Apr 2011, 09:38 AM
Hello Matthew,

Please, refer to the other support ticket post for additional information. To avoid duplicate posts, I will ask you to continue our communication there.

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Matthew Graybosch
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or