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

Sorting command fails

3 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dmitry
Top achievements
Rank 1
Dmitry asked on 11 Aug 2011, 12:10 PM
Hello,
My grid contains only template columns which are built runtime. Also I create custom header template, like this:

public void InstantiateIn(Control container)
        {
            LinkButton label;
            if (_item != null)
            {
                label = new LinkButton()
                            {
                                Text = _item.caption                                
                            };
                CssStyle style = _styleBuilder.CreateStyle(_item.f_name + "_header",
                                                                             _item.RunTimeColumnInformation.
                                                                                 HeaderAppearance);
                if (_styles.Find(s => s.Name == style.Name) == null)
                {
                    _styles.Add(style);
                }
                ((GridTableHeaderCell)container).CssClass = style.Name;
            }
            else
                label = new LinkButton()
                            {
                                Text = _caption
                            };
            label.CommandName = "Sort";
            label.CommandArgument = _item.user_name;
            container.Controls.Add(label);
        }
Each time I click header, I receive a message
Sys.WebForms.PageRequestManagerServerErrorException: "/UpeWeb.ASPNET/Telerik.Web.UI.WebResource.axd" is not a valid script path. Path must have ".js" extension.
I'm not sure this is a correct translation, because I see it on my native language, but you should get an idea of what's going on. Looks like it happened because of new AJAX control made by me from scratch. It's of CompositeControl type and implements IScriptControl. And each time there's a postback on page, I receive a message like this.
Thank you.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 Aug 2011, 12:30 PM
Hello Dmitry,

I suppose this issue arises because RadGrid does not support mixing declarative grid columns with grid columns added dynamically at runtime. You should either create all the columns in the grid programmatically, or else define them all in the ASPX file. Make sure that you are creating the columns entirely from code behind. Check the following help documentation which explains more about this.
Programmatic Creation.

Thanks,
Princy
0
Dmitry
Top achievements
Rank 1
answered on 11 Aug 2011, 12:36 PM
Perhaps there's some missunderstanding because of my English :) I create all columns programmatically, and in each column I create ItemTemplate and HeaderTemplate, each also made programmatically.
And almost forgot - I place my AJAX control to ItemTemplate I create.
0
Mira
Telerik team
answered on 16 Aug 2011, 03:28 PM
Hello Dmitry,

I tried to replicate the issue which you described, but to no avail.
Attached to this message, you will find the code which I used for testing.

Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.

Best wishes,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Dmitry
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Dmitry
Top achievements
Rank 1
Mira
Telerik team
Share this question
or