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

RadGrid inside a RadCombobox using GridTemplateColumn

2 Answers 57 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 23 Oct 2012, 08:17 PM
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 Answers, 1 is accepted

Sort by
0
Cat Cheshire
Top achievements
Rank 1
answered on 29 Oct 2012, 09:31 AM
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.
0
Patrick
Top achievements
Rank 1
answered on 29 Oct 2012, 08:03 PM
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.
Tags
ComboBox
Asked by
Patrick
Top achievements
Rank 1
Answers by
Cat Cheshire
Top achievements
Rank 1
Patrick
Top achievements
Rank 1
Share this question
or