RadGrid inside a RadCombobox using GridTemplateColumn

3 posts, 0 answers
  1. Patrick
    Patrick avatar
    19 posts
    Member since:
    May 2012

    Posted 23 Oct 2012 Link to this post

    I have an ASP:Gridview with RadComboBoxes set up inside of that.  These RadComboBoxes have their items dynamically created, so each RadComboBox has their items different from another RadComboBox.  This was all well and great until I was instructed to insert 10 columns.  Since the RadComboBox's header refuses to scroll along with the items, I feel like I'm forced to use a RadGrid inside of the RadComboBox.  I was thinking I could use a GridTemplateColumn to accomplish the goal.  Unfortunately, all I'm getting are two thick lines with no data inside of them.  Can you take a look at the following code and possibly help me out, please?  Maybe I totally screwed things up...

    ASPX:
    <telerik:RadComboBox ID="cboDupChoices" runat="server" DropDownWidth="600px"
      EnableLoadOnDemand="false" style="display:none">
        <ItemTemplate>
            <telerik:RadGrid ID="x" runat="server" Height="300px">
                <MasterTableView AutoGenerateColumns="false">
                    <Columns>
                        <telerik:GridTemplateColumn HeaderText="Test">
                            <HeaderStyle Width="75px" />
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container, "Attributes[""ID1""]")%>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
    ... REPEAT 9 MORE TIMES ...
                    </Columns>
                </MasterTableView>
                <ClientSettings>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="300px" />
                </ClientSettings>
            </telerik:RadGrid>
        </ItemTemplate>
    </telerik:RadComboBox>

    VB:
    cboTest.Style.Value = "display:block"
    cboTest.Items.Clear()
     
    Dim lnJ As Integer = 0
    For Each dupFile As FILE In dupFiles
        ' Add item template here.
        Dim test As RadComboBoxItem = New RadComboBoxItem()
        test.Attributes("ID1") = dupFile.FIELD1
        test.Attributes("Status") = dupFile.FIELD2
        test.Attributes("Department") = dupFile.FIELD3
        test.Attributes("Description") = dupFile.FIELD4
    ... REPEAT 6 MORE TIMES ...
     
        test.Value = dupFile.FILEID
        test.Text = dupFile.FILEID
        cboTest.Items.Add(test)
        cboTest.Items(lnJ).DataBind()
        lnJ = lnJ + 1
    Next

    Thanks for any help you may have,
    Patrick
  2. Cat Cheshire
    Cat Cheshire avatar
    128 posts
    Member since:
    Jun 2010

    Posted 29 Oct 2012 Link to this post

    Nesting a grid in combo is quite complicated.
    Have you tried to set the DropDownWidth property of the combo?
    If you set the width to some appropriate value - all 10 columns will be visible.
  3. Patrick
    Patrick avatar
    19 posts
    Member since:
    May 2012

    Posted 29 Oct 2012 Link to this post

    Yeah I agree.  I did find a way to get a successful grid inside of a combobox, but because there were fields that were numerous in number, all of the headers spilled outside of the combobox, or I could scroll through the combobox, but the header row was not scrolling along with the rest of the grid.  As I was finding no solutions to this issue besides changing controls, I gave up on that idea and I am now trying a Hierarchical RadGrid solution.  I think I'm having much better luck there.

    Thank you for your assistance.
Back to Top