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

Error with RadGrid inside FormView

7 Answers 221 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Henrique Duarte
Top achievements
Rank 1
Veteran
Henrique Duarte asked on 10 Aug 2008, 11:27 PM
Hi,

I'm getting this error after FormView Updated or Inserted :
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Script control 'gridEnderecos' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl

Here is my code:

    <telerik:RadAjaxManager ID="ajaxManager" runat="server" ClientEvents-OnRequestStart="requestStart" ClientEvents-OnResponseEnd="requestEnd" DefaultLoadingPanelID="loadingPanel" EnablePageHeadUpdate="False"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="bSalvar"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="formImovel" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="formImovel$gridEnderecos"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="formImovel$gridEnderecos" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
 
    <asp:FormView ID="formImovel" runat="server" Width="100%" DefaultMode="Edit" DataKeyNames="CdImovel" DataSourceID="ldsImovel" OnItemInserted="formImovel_ItemInserted" OnItemInserting="formImovel_ItemInserting" OnItemUpdated="formImovel_ItemUpdated" OnItemUpdating="formImovel_ItemUpdating"
        <EditItemTemplate> 
            <table style="margin-bottom: 10px;"
                <tr> 
                    <td> 
                        Código: 
                    </td> 
                    <td> 
                        <asp:Label ID="lCdImovel" runat="server" Text='<%# Eval("CdImovel") %>' /> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        Nome: 
                    </td> 
                    <td> 
                        <telerik:RadTextBox ID="iNome" runat="server" Width="300px" MaxLength="100" Text='<%# Bind("NmImovel") %>'
                        </telerik:RadTextBox> 
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator_iNome" runat="server" ControlToValidate="iNome"><img src="../../../Imagens/iconErro.gif" style="vertical-align:middle" alt="Erro" /> Obrigatório</asp:RequiredFieldValidator> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        Unidade Gestora Responsável: 
                    </td> 
                    <td> 
                        <telerik:RadComboBox ID="iCdUnidadeGestora" runat="server" DataSourceID="ldsUnidadeGestora" DataTextField="NmUnidadeGestora" DataValueField="CdUnidadeGestora" SelectedValue='<%# Bind("CdUnidadeGestora") %>'
                        </telerik:RadComboBox> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        Tipo do Imóvel: 
                    </td> 
                    <td> 
                        <telerik:RadComboBox ID="iTipoImovel" runat="server" DataSourceID="ldsTipoImovel" DataTextField="NmTipoImovel" DataValueField="CdTipoImovel" SelectedValue='<%# Bind("CdTipoImovel") %>'
                        </telerik:RadComboBox> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        Área do Terreno: 
                    </td> 
                    <td> 
                        <telerik:RadNumericTextBox ID="iAreaTerreno" runat="server" Width="70" Type="Number" MinValue="1" MaxLength="5" MaxValue="32767" DbValue='<%# Bind("AreaTerreno") %>'
                            <NumberFormat DecimalDigits="0" /> 
                        </telerik:RadNumericTextBox> 
                        m² 
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator_iAreaTerreno" runat="server" ControlToValidate="iAreaTerreno"><img src="../../../Imagens/iconErro.gif" style="vertical-align:middle" alt="Erro" /> Obrigatório</asp:RequiredFieldValidator> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        Área Construída: 
                    </td> 
                    <td> 
                        <telerik:RadNumericTextBox ID="iAreaConstruida" runat="server" Width="70" Type="Number" MinValue="1" MaxLength="5" MaxValue="32767" DbValue='<%# Bind("AreaConstruida") %>'
                            <NumberFormat DecimalDigits="0" /> 
                        </telerik:RadNumericTextBox> 
                        m² 
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator_iAreaConstruida" runat="server" ControlToValidate="iAreaConstruida"><img src="../../../Imagens/iconErro.gif" style="vertical-align:middle" alt="Erro" /> Obrigatório</asp:RequiredFieldValidator> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        Usuário: 
                    </td> 
                    <td> 
                        <asp:Label ID="lLogUsuario" runat="server" Text='<%# Bind("LogUsuario") %>'></asp:Label> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        Data: 
                    </td> 
                    <td> 
                        <asp:Label ID="lLogData" runat="server" Text='<%# Bind("LogData","{0:d}") %>'></asp:Label> 
                    </td> 
                </tr> 
            </table> 
            <telerik:RadGrid ID="gridEnderecos" runat="server" DataSourceID="ldsEnderecos" OnItemDataBound="gridEnderecos_ItemDataBound" AutoGenerateColumns="False" GridLines="None"
                <MasterTableView DataKeyNames="CdEndereco" Caption="Endereços" ClientDataKeyNames="CdEndereco" CommandItemDisplay="Top"
                    <CommandItemSettings AddNewRecordText=" Adicionar" RefreshText="" /> 
                    <RowIndicatorColumn Visible="False"
                        <HeaderStyle Width="20px" /> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn Resizable="False" Visible="False"
                        <HeaderStyle Width="20px" /> 
                    </ExpandCollapseColumn> 
                    <Columns> 
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataFormatString="{0:00000-000}" DataField="CEP" DataType="System.Decimal" FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="CEP" SortExpression="CEP" UniqueName="CEP" HeaderStyle-Width="80"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="Logradouro" FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="Logradouro" SortExpression="Logradouro" UniqueName="Logradouro" HeaderStyle-Width="320"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="Bairro" FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="Bairro" SortExpression="Bairro" UniqueName="Bairro" HeaderStyle-Width="150"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="Cidade" FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="Cidade" SortExpression="Cidade" UniqueName="Cidade" HeaderStyle-Width="150"
                        </telerik:GridBoundColumn> 
                    </Columns> 
                </MasterTableView> 
            </telerik:RadGrid> 
        </EditItemTemplate> 
    </asp:FormView> 
 
    <asp:Button ID="bSalvar" runat="server" CausesValidation="True" OnClick="bSalvar_Click" Text="Salvar" Style="margin-right: 10px;" /> 
 

What is happening??

Regards,

Henrique

7 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 11 Aug 2008, 10:21 AM
Hello Henrique,

Have you tried wrapping the FormView into an ASP:Panel and add Panel -> Panel AJAX setting instead? Here are the expected settings for your convenience:

    <AjaxSettings>  
        <telerik:AjaxSetting AjaxControlID="bSalvar">  
            <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="Panel1" />  
            </UpdatedControls>  
        </telerik:AjaxSetting>  
        <telerik:AjaxSetting AjaxControlID="Panel1">  
            <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="Panel1" />  
            </UpdatedControls>  
        </telerik:AjaxSetting>  
    </AjaxSettings>  

I hope this helps!

Best wishes,
Konstantin Petkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Henrique Duarte
Top achievements
Rank 1
Veteran
answered on 11 Aug 2008, 10:31 AM
Hi Konstantin,

It didn't work.
After Inserted or Updated a record, I need to redirect to same page to avoid this issue.

Another suggestion?

Regards,

Henrique
0
Konstantin Petkov
Telerik team
answered on 15 Aug 2008, 08:04 AM
Hi Henrique,

I've checked our records and it seems we've got a few other reports with the same error and RadGrid including one when the Grid has been placed in a FormView. It appeared however the issue was caused by improper AJAX settings but in your case those look correct. I assume there is something else within the implementation so we will need to look into your code and investigate the problem locally instead of shooting in the dark.

Can you please isolate the problem as much as possible (removing controls/code which do not affect the problem) and send a runnable application through a regular support ticket? You can use dummy data binding the Grid/FormView since I bet the data has nothing with the actual problem.

We will gladly debug the error and get back to you with our findings/resolution. Thank you for the understanding and cooperation and looking forward to hearing from you.

Best wishes,
Konstantin Petkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Vlad
Telerik team
answered on 15 Aug 2008, 11:03 AM
Hello Henrique,

I have verified your project and I notice that this exception was caused by this ajax setting:

            <telerik:AjaxSetting AjaxControlID="FormView1$RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="FormView1$RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>

Please remove this to avoid the problem!

Kind regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Henrique Duarte
Top achievements
Rank 1
Veteran
answered on 15 Aug 2008, 11:22 AM
Hi Vlad,

There is no other to do that?
My FormView is huge and I need to insert items in RadGrid before saving the data.

Regards,

Henrique
0
Accepted
Vlad
Telerik team
answered on 15 Aug 2008, 11:30 AM
Hello Henrique,

Here is an example how to add the same setting programatically:

        protected void Page_PreRenderComplete(object sender, EventArgs e)
        {
            RadGrid RadGrid1 = (RadGrid)FormView1.FindControl("RadGrid1");
            RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadGrid1, RadGrid1);
        }

Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul
Top achievements
Rank 1
answered on 23 Sep 2009, 07:44 PM
I had the same problem with a radGrid inside an asp:FormView. The radGrid uses a userControl as its EditForm (irrelevant?). I was getting:

      script control '' is not a registered script control. script controls must be registered using registerscriptcontrol() before calling registerscriptdescriptors().

My code (copied from http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx ) included this:

        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>


When removed, my error went away and my page worked correctly.

Paul
Tags
Ajax
Asked by
Henrique Duarte
Top achievements
Rank 1
Veteran
Answers by
Konstantin Petkov
Telerik team
Henrique Duarte
Top achievements
Rank 1
Veteran
Vlad
Telerik team
Paul
Top achievements
Rank 1
Share this question
or