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

[Solved] Script Error In Nested Grid Popup Editing Telerik Textbox

5 Answers 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pradeep N
Top achievements
Rank 1
Pradeep N asked on 28 Sep 2010, 01:04 PM
Hi,
I am using Ajax bounded nested grid with Add/Edit Popup Edit Mode.
The model has Numeric & currency textboxes. I am using the editor templates for editors from the samples as it is. 
In the firstlevel grid New/Edit  popup works fine works fine.
In the second level grid during the first ajax call also the new/edit popup is working fine.
if i make another ajax call that opens 2nd level of grid the following script error is throw in the grid-edit .js and the form disappears.

h(w).data("tTextBox") is null
http://localhost:50639/Scripts/2010.2.825/telerik.grid.editing.min.js
Line 1

If i replace numeric & currency textbox with normal one, every thing works fine.
Same senario also applies for inform editing also.

Regards,
Pradeep

5 Answers, 1 is accepted

Sort by
0
Joan Vilariño
Top achievements
Rank 2
answered on 28 Sep 2010, 03:31 PM
I think you should include "telerik.textbox.js" in your form... as it's not automatically loaded if you use those components in ajax...

Just add the ScriptRegistrar stuff at your form to include that script file... I think it should work
0
Pradeep N
Top achievements
Rank 1
answered on 29 Sep 2010, 05:19 AM
Hi,
I am using the whole pack in the masterpage as follows.
<% Html.Telerik().ScriptRegistrar()
                     .DefaultGroup(group => group
                         .Add("telerik.examples.js")
                         .Compress(true))
                     .OnDocumentReady(() => { %>prettyPrint();<% })
                     .Render(); %>

For the first time lazy loaded grid it works fine, but for others it throws error. 

To give example of what i am saying is, in the following sample
http://demos.telerik.com/aspnet-mvc/grid/hierarchyajax

If i click on nancy, Nancy's orders grid is getting displayed and i have edit button. if i click on edit button i the popup opens and every thing works fine.

After this if i click on andrew's orders or janet's  orders grid gets populated but if i click on edit script errors thrown and the edit form disappeared.

Only first time loaded edit form only works.

Regards,
Pradeep.
0
Joan Vilariño
Top achievements
Rank 2
answered on 29 Sep 2010, 08:09 AM
Sorry maybe with the rush I didn't explain myself as I wanted...

Its not the fact that you include ScriptRegistrar in your page. As the grid is loaded in a template and its ajax, the scriptregistrar object won't detect your numeric textbox, and so, it won't add the references for "telerik.textbox.js" that is needed for that edit row. So, you have to "force" it loading this way:

<% Html.Telerik().ScriptRegistrar()
                     .DefaultGroup(group => group
                         .Add("telerik.examples.js")
                         .Add("telerik.textbox.js")
                         .Compress(true))
                     .OnDocumentReady(() => { %>prettyPrint();<% })
                     .Render(); %>

Maybe you will need some more scripts... not sure without checking all your code, but for the numeric textboxes, "telerik.textbox.js" should do fine.

I hope this helps

Cheers
0
Atanas Korchev
Telerik team
answered on 29 Sep 2010, 08:18 AM
Hi,

 There is a bug in the current official release which causes the JavaScript files of Telerik UI components defined in a grid editor template to not get loaded. We have fixed that bug already. You can apply the fix easily by modifying ViewComponentFactory.cs. Replace the original contents of the Create method with this:

        public TViewComponent Create<TViewComponent>(Func<TViewComponent> factory) where TViewComponent : ViewComponentBase
        {
            TViewComponent component = factory();

            scriptRegistrarBuilder.ToRegistrar().Register(component);

            return component;
        }

Regards,
Atanas Korchev
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
Pradeep N
Top achievements
Rank 1
answered on 29 Sep 2010, 11:02 AM
HI Joan,Admin,
Thanks for your quick responses guys,
I tried both but none of them seems to work. Same issue exists.
Any other ideas?
 


Tags
Grid
Asked by
Pradeep N
Top achievements
Rank 1
Answers by
Joan Vilariño
Top achievements
Rank 2
Pradeep N
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or