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

Controls collection Cannot be modified

1 Answer 91 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Akhtar
Top achievements
Rank 1
Akhtar asked on 26 Mar 2016, 06:52 AM

Hi i am Akhtar Abbas i am using telerik controls in my ASP.NET web application. I am currently designig a login page i am using RadStyleSheetManager, RadAjaxManager, RadAjaxLoadingPanel and RadCodeBlock. the HTML for the page is below

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="AccessCenter.Login" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta charset="utf-8">

    <title>Log In</title>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
      <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
    <div class="wrapper">
        <div class="back1">

            <p class="title">Evac</p>
            <form runat="server" id="form1" class="login">
                <asp:ScriptManager runat="server" ID="smLogin"></asp:ScriptManager>
                
                <telerik:RadStyleSheetManager runat="server">
                    <StyleSheets>                        
                        <telerik:StyleSheetReference Path="css/normalize.css" />
                        <telerik:StyleSheetReference Path="css/login.css" />
                    </StyleSheets>
                </telerik:RadStyleSheetManager>


                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="btnLogin">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="form1" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                                <telerik:AjaxUpdatedControl ControlID="txtUserName"></telerik:AjaxUpdatedControl>
                                <telerik:AjaxUpdatedControl ControlID="txtPassword"></telerik:AjaxUpdatedControl>
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                </telerik:RadAjaxManager>

                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
                </telerik:RadAjaxLoadingPanel>

                <asp:TextBox runat="server" ID="txtUserName" placeholder="Username" autofocus></asp:TextBox>

                <asp:TextBox runat="server" ID="txtPassword" placeholder="Password"></asp:TextBox>

                <asp:TextBox runat="server" ID="txtCaptcha" CssClass="captcha-fld"></asp:TextBox>

                <asp:TextBox runat="server" ID="txtCaptchaText" CssClass="captcha-fld-type"></asp:TextBox>

                <button>
                    <i class="spinner"></i>
                    <asp:Button runat="server" ID="btnLogin" CssClass="login-submit" OnClick="btnLogin_Click" />
                </button>
                <asp:Label ID="lblError" runat="server" ForeColor="Red" Visible="false"></asp:Label>
                <a href="#">Forgot your password?</a>
                <a class="right2" href="#">Sign Up</a>
                
                <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                    <script src="js/index.js" type="text/javascript"></script>
                </telerik:RadCodeBlock>
            </form>
        </div>
        <footer></footer>
    </div>
    <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>

I also have added settings in web.config.

 

<appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
    <add key="Telerik.Web.UI.StyleSheetFolders" value="~/css" />
  </appSettings>

<system.web>

    <httpHandlers>
      <add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false" />
    </httpHandlers>
    
  </system.web>

<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <remove name="ApplicationInsightsWebTracking"/>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler"/>
    </modules>
    <handlers>
      <add name="Telerik_Web_UI_DialogHandler_aspx" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler"/>
      <add name="Telerik_Web_UI_SpellCheckHandler_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler"/>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource"/>
    </handlers>
  </system.webServer>

 

when i load my page then i have got the following error on the page

 

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

 

How to resolve this?

Note: These controls are purchased controls

I neet urgent responce please reply me as fast as possible because i have deadline of the project

 

 

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 30 Mar 2016, 12:54 PM
Hello,

Note that adding the form element into Ajax setting is not a valid scenario. Therefore please add the inner form controls in the Ajax settings separately but not the whole form and see how it goes.

Regards,
Maria Ilieva
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
General Discussions
Asked by
Akhtar
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or