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

RadGrid/RadComboBox Error

5 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew Buxton
Top achievements
Rank 1
Andrew Buxton asked on 11 Aug 2010, 10:07 AM
Hi,

This is an interesting problem and I'm hoping you're able to help. I have a RadGrid in a page that is being displayed in a RadWindow. I am using the "InPlace" edit method on the grid which sits in the middle of the page and is updated using the RadAjaxManager. This all works fine. I should explain that I'm not using the datasource auto update functionality of the RadGrid, I'm fetching the values on the server-side and managing the update of the datasource myself. This all works as we would expect.

I then came to the point where I needed to add a RadComboBox into one of the columns of the grid. So I removed the GridBoundColumn and replaced it with a GridTemplateColumn. I populate the RadComboBox from the code-behind using the ItemDataBound event handler. Whilst the RadComboBox appears to populate I now receive an error in the Microsoft Ajax client library, when I click to edit a row in the grid. This is fairly simple code but I'm unable to see where the issue is.

What is interesting is this ... If I put back the GridBoundColumn and have both in the grid at the same time, I don't receive the client-side error at all, the RadComboBox populates and works as it should. As soon as I remove the GridBoundColumn, it stops working.

I have included snippets from the code below. I would appreciate any help you can give, many thanks.

The Error
library: MicrosoftAjax.js
line : var a=g?new h(g):new h
output: Object Expected

Code Behind
        public void DetailGrid_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                /* find the combo box that we're going to populate the detail types with */
                RadComboBox ddlDetailTypes = (RadComboBox)e.Item.FindControl("ddlDetailTypes");

                /* get the detail types to bind to the drop down list */
                Dictionary<int, string> detailtypes = presenter.GetDetailTypes();

                /* bind the drop down list */
                ddlDetailTypes.DataSource = detailtypes;
                ddlDetailTypes.DataBind();

                /* select the value in the drop down list */
                if (e.Item.DataItem != null)
                    ddlDetailTypes.SelectedValue = ((DetailModel)e.Item.DataItem).Type.ToString();
            }
        }

Grid Bound Column
                        <telerik:GridDropDownColumn UniqueName="Type" DataField="Type" Visible="true" HeaderText="Type">
                            <ItemStyle Width="60" />
                        </telerik:GridDropDownColumn>

Template Column (with RadComboBox)
                        <telerik:GridTemplateColumn UniqueName="Type" Visible="true" HeaderText="Type">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "TypeDescription") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadComboBox DataTextField="Value" DataValueField="Key"  ID="ddlDetailTypes" runat="server" Skin="WebBlue" EnableEmbeddedScripts="false">
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                            <ItemStyle Width="60" />
                        </telerik:GridTemplateColumn>

5 Answers, 1 is accepted

Sort by
0
Andrew Buxton
Top achievements
Rank 1
answered on 16 Aug 2010, 11:42 AM
Any ideas on this one?

For further info, if I leave the templated column in and just remove the RadComboBox declaration the grid renders fine. Just to be sure I commented out the server-side databind code and still got the JavaScript error, so it's definately something to do with adding the ComboBox into a templated column in the grid.

Hope you can help with this,


Andy.
0
Andrew Buxton
Top achievements
Rank 1
answered on 16 Aug 2010, 11:50 AM
In addition to this it works perfectly with the standard asp:DropDownList control, so it must be an issue with the RadComboBox.

Andy.
0
Veli
Telerik team
answered on 16 Aug 2010, 12:53 PM
Hello Andrew,

You have disabled the embedded scripts of the combo. RadComboBox cannot work without its client scripts loaded, so if you do not load the scripts manually on the page, this is probably what's causing the JS error you are getting.

All the best,
Veli
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
0
Andrew Buxton
Top achievements
Rank 1
answered on 16 Aug 2010, 02:04 PM
Hi Veli,

How silly is that, I couldn't see it for looking. It should be EnableEmbeddedSkins="false" not Scripts! A true Baldrick moment.

Many thanks, I shall give that a try.

Best,


Andy.
0
Hansel Eduard
Top achievements
Rank 1
answered on 16 Jun 2016, 01:32 AM

I have the same problem.
I hope that anyone can help me

Thanks!

Tags
Grid
Asked by
Andrew Buxton
Top achievements
Rank 1
Answers by
Andrew Buxton
Top achievements
Rank 1
Veli
Telerik team
Hansel Eduard
Top achievements
Rank 1
Share this question
or