Share via


ajaxToolkit:CalendarExtender - Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Question

Friday, October 19, 2007 8:48 PM

This is what I have in my code 

<asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>

<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtStartDate"></ajaxToolkit:CalendarExtender>

And here is the error:
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

 If I remove the calendar extender, page renders OK.

Looking at the demo page, it lists ajaxToolkit:Calendar control but that does not list in my code. My runtime version is v2.0.50727 and version is 1.0.10606.0 of AjaxControlToolkit.

 

Any suggestions?

 Thanks.

 

 

All replies (20)

Thursday, October 25, 2007 1:51 AM ✅Answered

Ok i'm betting fake money that in your masterpages head tag you have a <%= %> code block. Probably to resolve a virtual path to some script or css file u are using.

RegisterCssReferences is attempting to add a link tag (or something) to the head tag and is failing cause of ur code block. I've had this same issue, should be fixable by wrapping the code block in a asp:PlaceHolder. 


Saturday, October 20, 2007 3:43 AM

 I doubt this error is caused by the CalanderExtender itself.

Post ur entire as(p/c)x code. Somewhere in ur page u must have a <%= %> block. If you have a <%= %> lock inside a naming container u cannot dynamically add new controls to the same naming container.

 


Sunday, October 21, 2007 11:56 PM

 Here is the ASPX code. 
 
           <div class="groupbox">
                 <h4><img src="/Forms/images/Letters/A.gif" /> Requesting On-behalf-of</h4>     
                 <ITBS:UserAndAssetInfo 
                        id="userAndAssetInfo" runat="server"
                        IsRequired="true" AssetHowToDisplay="SelectMultiple" AssetOtherShowOption="true"
                        ></itbs:UserAndAssetInfo>            
            </div>
            <div class="groupbox">
                <h4><img src="/Forms/images/Letters/B.gif" /> From and to dates</h4>
                    <table width="100%" >
                        <tr>
                            <td width="30%">
                                <span class="label">What date do you need this by?</span>                                
                                
                            </td>
                            <td>
                                <nobr>
                                <style>
                                    .left0margin {margin: 0 0 0 0}
                                </style>
                                <asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>
                                <ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtStartDate"></ajaxToolkit:CalendarExtender>
                                Please allow up to 5 business days for delivery.
                                </nobr>
                            </td>
                        </tr>
                        
                        <tr>
                            <td width="30%">
                                <span class="label">What date do you plan on returning it?</span>                                
                                
                            </td>
                            <td>
                                <nobr>
                                <style>
                                    .left0margin {margin: 0 0 0 0}
                                </style>
                                <!--date control-->
                                Please allow up to 5 business days for delivery.
                                </nobr>
                            </td>
                        </tr>
                    </table>
            </div>

Wednesday, October 24, 2007 8:05 PM

I can't see any <%= %> blocks. I also can't see ur <form tag which tells me this isn't ur "entire" aspx code.

Try wrapping ur textbox and calanderextender in a control that implements INamingContainer. Actually i'm not sure it even needs to implement INamingContainer, just try wrapping it in a <asp:PlaceHolder>
 


Thursday, October 25, 2007 12:48 AM

I still get the same error.  Here is the entire page. THe page uses a masterpage so you would not see the forms tag. I have also attached the stacktrace.

 

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPages/Forms.master"  CodeBehind="InfoPage.aspx.cs" Inherits="InfoPage" %>
<%@ Register TagPrefix="ITBS" TagName="UserAndAssetInfo" src="~/FormControls/Common/UserInfoWithAssetInfo.ascx" mce_src="~/FormControls/Common/UserInfoWithAssetInfo.ascx" %>

 

1    <asp:Content ContentPlaceHolderID="mainContent" ID="mainFiller" runat="Server">    
2        <asp:PlaceHolder ID="plHldrControls" runat="server">
3            <asp:Literal ID="ltlMessage" runat="server"></asp:Literal>        
4                <div class="groupbox">
5                     <h4><img src="/Forms/images/Letters/A.gif" /> User Information</h4>     
6                     <ITBS:UserAndAssetInfo 
7                            id="userAndAssetInfo" runat="server"
8                            IsRequired="true" AssetHowToDisplay="SelectMultiple" AssetOtherShowOption="true"
9                            ></itbs:UserAndAssetInfo>            
10               </div>
11               <div class="groupbox">
12                   <h4>From and to dates</h4>
13                       <table width="100%" >
14                           <tr>
15                               <td width="30%" valign="top">
16                                   <span class="label">What date do you need this by?</span>                                
17                                   
18                               </td>
19                               <td>
20                                   <div>
21                                   <asp:PlaceHolder ID="temp" runat="server">
22                                   <asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox> 
23                                   <ajaxToolkit:CalendarExtender runat="server"  TargetControlID="txtStartDate"></ajaxToolkit:CalendarExtender>
24                                   </asp:PlaceHolder>
25                                   </div>
26                                </td>
27                           </tr>                        
28                       </table>
29               </div>
30                          
31               
32               <div class="groupbox">
33                   <div align="center">
34                       <asp:Button ID="btnSubmit" runat="server" CssClass="bigButton" Text="Submit" OnClick="btnSubmit_Click" />
35                       <input type="button" class="bigButton" value="Cancel" 
36                           onclick="if(confirm('Are you sure you want to cancel this request?'))parent.location.href='Home.aspx';" />
37                   </div>
38               </div>
39       </asp:PlaceHolder>
40   
41   </asp:Content>

 

Here is the stacktrace:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +2105903
   AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control control) +757
   AjaxControlToolkit.ExtenderControlBase.OnPreRender(EventArgs e) +135
   System.Web.UI.Control.PreRenderRecursiveInternal() +77
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360


Thursday, October 25, 2007 3:14 AM

Thanks! That did the trick. I used a different MasterPage and it worked just fine.

 


Monday, January 14, 2008 1:23 PM

"]

Ok i'm betting fake money that in your masterpages head tag you have a <%= %> code block. Probably to resolve a virtual path to some script or css file u are using.

RegisterCssReferences is attempting to add a link tag (or something) to the head tag and is failing cause of ur code block. I've had this same issue, should be fixable by wrapping the code block in a asp:PlaceHolder. 

 

 

Wanted to say Thank You for hitting the nail on the head !


Sunday, March 30, 2008 6:58 AM

 How did you reformat your masterpage?

I have the exact same problem: I try with a clean masterpage and it works, but with my standard masterpage it doesn't. Where do I put the placeholder tags?

 

Here's the <%...%> part  of my masterpage:

<style type="text/css" media="screen"> @import url(<%=ResolveUrl("~/Includes/themes/customer." + ui.Customer.CustomerId + "/theme.css")%>); </style> 

/Jonas 


Sunday, March 30, 2008 7:16 PM

Hi Jonas,

Just wrap your style tag in a placeholder like so:

<asp:PlaceHolder Runat="server">

  <style ...>...</style>

</asp:PlaceHolder>


Wednesday, June 18, 2008 6:41 PM

I just wanted to say thank you too!  I have so much to learn about 3.5 framework, as I'm used to 1.1 [:|]

This worked for me, as I have <%=WebRoot%> variable in my master page header so I can use my styles on content pages.


Thursday, September 18, 2008 12:06 PM

i have the same issue except i am not using a masterpage... 

Here is my entire source code, i must be missing something....

1    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Index" %>
2    
3    <%@ Register Src="DataResults.ascx" TagName="DataResults" TagPrefix="uc2" %>
4    <%@ Register Assembly="ESRI.ArcGIS.ADF.Web.UI.WebControls, Version=9.2.4.1420, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86"
5        Namespace="ESRI.ArcGIS.ADF.Web.UI.WebControls" TagPrefix="esri" %>
6    <%@ Register Assembly="ESRI.ArcGIS.ADF.Web.UI.WebControls, Version=9.2.3.1380, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" Namespace="ESRI.ArcGIS.ADF.Web.UI.WebControls" TagPrefix="esri" %>
7    <%@ Register Assembly="ESRI.ArcGIS.ADF.Tasks, Version=9.2.3.1380, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86" Namespace="ESRI.ArcGIS.ADF.Tasks" TagPrefix="esriTasks" %>
8    <%@ Register Src="Measure.ascx" TagName="Measure" TagPrefix="uc1" %>
9    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
10   
11   <html xmlns="http://www.w3.org/1999/xhtml" >
12   <head runat="server">
13       <title>Finger Lakes Vineyard Temperature Mapping</title>
14       <link href="VineyardStyleSheet.css" rel="stylesheet" type="text/css" />
15        <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>    
16       <link href="style_blue.css" rel="stylesheet" type="text/css" />
17       <SCRIPT LANGUAGE="JavaScript" SRC="JavaScript/CalendarPopup.js"></SCRIPT>
18       <!-- This prints out the default stylehseets used by the DIV style calendar.
19        Only needed if you are using the DIV style popup -->
20       <SCRIPT LANGUAGE="JavaScript">document.write(getCalendarStyles());</SCRIPT>
21       <script language="javascript">
22   function CatchServerReturn(url,output)
23   {
24       //alert(url + " " + output);
25       hideBusyIndicator();
26       
27   }
28   function ZoomVineyard(servermethod,value)
29   {
30        showBusyIndicator();
31        var message = servermethod + ',' + value;
32        <%=sADFCallBackFunctionInvocation%> 
33       //document.getElementById("aoi").selected = value;
34       //CallServer(servermethod + "," + value);
35   }
36   var context;
37   function RunQuery()
38   {
39        showBusyIndicator();
40        var message = 'RunQuery, rval';
41        var griddiv = document.getElementById('griddiv');
42        griddiv.style.visibility = 'visible';
43       
44        <%=sADFCallBackFunctionInvocation%> 
45        //document.getElementById('exp').style.visibility = 'visible';
46   }
47   function GetQueryResults(rval,rval2)
48   {
49    
50       var griddiv = document.getElementById('griddiv');
51       griddiv.style.visibility = 'visible';
52       griddiv.innerHTML = rval;
53       hideBusyIndicator();
54   }
55   function ShowTOC()
56   {
57       document.getElementById('maplayers').style.visibility = 'visible'; ;
58   }
59   function HideTOC()
60   {
61      document.getElementById('maplayers').style.visibility = 'hidden'; 
62   }
63   function WebForm_CallbackComplete_SyncFixed() {
64           // SyncFix: the original version uses "i"
65           // as global thereby resulting in
66           // javascript errors when "i" is used
67           // elsewhere in consuming pages
68   
69     for (var i = 0; i < __pendingCallbacks.length; i++) {
70         callbackObject = __pendingCallbacks[ i ];
71         if (callbackObject && callbackObject.xmlRequest && (callbackObject.xmlRequest.readyState == 4)) {
72             // the callback should be executed after releasing all resources
73             // associated with this request.
74             // Originally if the callback gets executed here and the callback
75             // routine makes another ASP.NET ajax request then the pending slots and
76             // pending callbacks array gets messed up since the slot is not released
77             // before the next ASP.NET request comes.
78             // FIX: This statement has been moved below
79             // WebForm_ExecuteCallback(callbackObject);
80             if (!__pendingCallbacks[ i ].async) {
81                  __synchronousCallBackIndex = -1;
82             }
83             __pendingCallbacks[i] = null;
84   
85             var callbackFrameID = "__CALLBACKFRAME" + i;
86             var xmlRequestFrame = document.getElementById(callbackFrameID);
87             if (xmlRequestFrame) {
88                  xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
89             }
90   
91             // SyncFix: the following statement has been moved down from above;
92             WebForm_ExecuteCallback(callbackObject);
93         }
94     }
95   }
96   window.onload = function Onload(){
97     if (typeof (WebForm_CallbackComplete) == "function") {
98         // set the original version with fixed version
99         WebForm_CallbackComplete = WebForm_CallbackComplete_SyncFixed;
100   }
101  }
102  
103  </script>
104  </head>
105  <body onbeforeunload="showBusyIndicator()" oninit="hideBusyIndicator()" onprerender="hideBusyIndicator()" id="qh" >
106      <form id="form1" runat="server"> 
107      <asp:ScriptManager ID="ScriptManager1" runat="server">
108          <Scripts>
109              <asp:ScriptReference Path="JavaScript/AjaxDelegate.js" />
110              <asp:ScriptReference Path="JavaScript/display_mapidentify.js" />
111              <asp:ScriptReference Path="JavaScript/display_measure.js" />
112              <asp:ScriptReference Path="JavaScript/dom-drag.js" />
113              <asp:ScriptReference Path="JavaScript/MapViewer.js" />
114              <asp:ScriptReference Path="JavaScript/VirtualEarth.js" />
115              <asp:ScriptReference Path="JavaScript/WebMapApp.js" />
116          </Scripts>
117          </asp:ScriptManager>
118          <script type="text/javascript" language="javascript">    
119          Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(PageLoadingHandler);    
120          function PageLoadingHandler(sender, args) 
121          {        
122              var dataItems = args.get_dataItems();        
123              if (dataItems['Map1'] != null)            
124                  processCallbackResult(dataItems['Map1'], 'Map1');    
125          }
126          </script>
127     <div id="container" align="center">
128       <div id="banner" style="width: 734px" align="center">
129         <div class="csschanger" align="left"><a href="Index.aspx" class="rlink">Home</a> | <a href="contacts.aspx" class="rlink">Contacts</a> | <a href="index3.aspx" class="rlink">Lite Version</a> </div>
130         </div>
131      <div id="containerboth" align="right">
132     
133          <table align="right" style="width: 389px; margin-left: 29px;" cellpadding="0" cellspacing="0">
134              <tr>
135                  <td align="center" rowspan="1" style="width: 168px; height: 424px;" valign="top">
136                      <input id="Button3" onclick="ShowTOC()" onmouseover="this.style.cursor='pointer'; this.style.cursor='hand'" onmouseout="this.style.cursor='auto'" style="width: 100px; border-right: #efefef thin solid; border-top: #efefef thin solid; font-size: 12px; background-image: url(images/TDBack_Marron.gif); border-left: #efefef thin solid; color: white; border-bottom: #efefef thin solid; height: 25px;" type="button" value="View TOC" /><br />
137                      <table style="width: 130px; height: 428px" align="left" bgcolor="#ffffff" cellpadding="1" cellspacing="0" >
138                          <tbody>
139                              <tr>
140                                  <td style="width: 14px; height: 16px">
141                                      <asp:Image ID="Image9" runat="server" ImageUrl="images\Arrow.gif" /></td>
142                                  <td align="left" colspan="3" style="width: 134px; height: 16px">
143                                      <asp:Label ID="Label7" runat="server" BackColor="White" Font-Bold="True" Font-Names="Arial"
144                                          Font-Size="8pt" ForeColor="#404040" Width="105px">Select Winery</asp:Label></td>
145                              </tr>
146                              <tr>
147                                  <td style="width: 14px; height: 22px">
148                                  </td>
149                                  <td align="left" colspan="3" style="width: 134px; height: 22px">
150                                      <select id="aoi" runat="server" onchange="ZoomVineyard('ZoomToVineyard', this.value)"
151                                          style="font-size: 10px; width: 106px; font-family: 'Trebuchet MS'; height: 20px" enableviewstate="true" atomicselection="false" onserverchange="aoi_ServerChange">
152                                          <option selected="selected" value="Select Area of Interest">Select Area of Interest</option>
153                                          <option value="Fox Run">Fox Run</option>
154                                          <option value="Glenora">Glenora</option>
155                                          <option value="Hazlitt">Hazlitt</option>
156                                          <option value="King Ferry">King Ferry</option>
157                                          <option value="Glenora">Loomis</option>
158                                          <option value="Red Tail Ridge">Red Tail Ridge</option>
159                                          <option value="Research South">Research South</option>
160                                          <option value="Verrill">Verrill</option>
161                                          <option value="Full Extent">Full Extent</option>
162                                      </select>
163                                  </td>
164                              </tr>
165                              <tr>
166                                  <td style="width: 14px; height: 21px">
167                                      <asp:Image ID="Image1" runat="server" ImageUrl="images\Arrow.gif" /></td>
168                                  <td align="left" colspan="3" style="width: 134px; height: 21px" valign="middle">
169                                      <asp:Label ID="Label3" runat="server" BackColor="White" Font-Bold="True" Font-Names="Trebuchet MS"
170                                          Font-Size="8pt" ForeColor="#404040">Select Start Date</asp:Label>
171                                        
172                                  </td>
173                              </tr>
174                              <tr style="font-family: Tahoma">
175                                  <td style="width: 14px">
176                                  </td>
177                                  <td align="left" colspan="3" style="width: 134px" valign="middle">
178                                      <asp:Label ID="slbl" runat="server" BackColor="White" Font-Bold="True" Font-Names="Trebuchet MS"
179                                          Font-Size="8pt" ForeColor="#404040">Start Date:</asp:Label>
180  
181                                      <script id="jscal1xx" language="JavaScript">
182                                                              var cal1xx = new CalendarPopup("testdiv1");
183                                                              try
184                                                              {
185                                                              cal1xx.showNavigationDropdowns();
186                                                              }
187                                                              catch(err)
188                                                              {
189                                                                  alert(err);
190                                                              }
191                                      </script>
192                                      <asp:TextBox ID="stb" runat="server" Width="78px" ForeColor="Green">8/1/2006</asp:TextBox>
193                                      
194                                              <img id="Img1" alt="Click to Open Start Date Calendar" border="0" src="images/Calendar.png" /></a>
195                                  </td>
196                              </tr>
197                              <tr style="font-family: Tahoma">
198                                  <td style="width: 14px; height: 22px">
199                                      <asp:Image ID="Image2" runat="server" ImageUrl="images\Arrow.gif" /></td>
200                                  <td align="left" colspan="3" style="width: 134px; height: 22px" valign="middle">
201                                      <asp:Label ID="Label5" runat="server" BackColor="White" Font-Bold="True" Font-Names="Trebuchet MS"
202                                          Font-Size="8pt" ForeColor="#404040">Select End Date</asp:Label>
203                                         
204  
205                                      <script id="jscal1xxx" language="JavaScript">
206                                                              var cal1xxx = new CalendarPopup("testdiv1");
207                                                              cal1xxx.showNavigationDropdowns();
208                                      </script>
209  
210                                      <input id="etb" name="date1xxx" onclick="alert('Read Only!\n\nUse calendar icon to right.')"
211                                          readonly="readonly" style="width: 74px" type="text" />  <a id="anchor1xxx" href="#"
212                                              name="anchor1xxx" onclick="cal1xxx.select(document.forms[0].date1xxx,'anchor1xxx','MM/dd/yyyy'); return false;"
213                                              title="cal1xxx.select(document.forms[0].date1xxx,'anchor1xxx','MM/dd/yyyy'); return false;">
214                                              <img id="Img2" alt="Click to Open Start Date Calendar" border="0" src="images/Calendar.png" /></a>
215                                  </td>
216                              </tr>
217                              <tr style="font-family: Tahoma">
218                                  <td style="width: 14px; height: 24px">
219                                  </td>
220                                  <td align="left" colspan="3" style="width: 134px; height: 24px">
221                                      <asp:Label ID="elbl" runat="server" BackColor="White" Font-Bold="True" Font-Names="Trebuchet MS"
222                                          Font-Size="8pt" ForeColor="#404040">End Date:</asp:Label>  
223                                  </td>
224                              </tr>
225                              <tr style="font-family: Tahoma">
226                                  <td style="width: 14px">
227                                      <img height="13" src="images/Arrow.gif" width="13" /></td>
228                                  <td align="left" colspan="3" style="width: 134px">
229                                      <asp:Label ID="Label1" runat="server" BackColor="White" Font-Bold="True" Font-Names="Trebuchet MS"
230                                          Font-Size="8pt" ForeColor="#404040">Select Query</asp:Label></td>
231                              </tr>
232                              <tr style="font-family: Tahoma">
233                                  <td style="width: 14px; height: 99px">
234                                  </td>
235                                  <td align="left" colspan="3" style="width: 134px; height: 99px" valign="top">
236                                      <input id="Radio1" language="javascript" onclick="SetQT(this.id,this.value)" style="width: 20px;
237                                          height: 19px" type="radio" value="MAX" /><asp:Label ID="Label2" runat="server" Font-Size="10px"
238                                              Height="21px" Text="High Temperatures" Width="90px"></asp:Label><br />
239                                      <input id="Radio2" language="javascript" onclick="SetQT(this.id,this.value)" style="width: 20px;
240                                          height: 19px" type="radio" value="MIN" /><asp:Label ID="Label4" runat="server" Font-Size="10px"
241                                              Height="21px" Text="Low Temperatures" Width="90px"></asp:Label><br />
242                                      <input id="Radio3" language="javascript" onclick="SetQT(this.id,this.value)" style="display: inline;
243                                          width: 20px; clip: rect(5px auto auto auto); height: 19px" type="radio" value="AVG" /><asp:Label
244                                              ID="Label6" runat="server" Font-Size="10px" Height="21px" Text="Avg Temperatures"
245                                              Width="90px"></asp:Label></td>
246                              </tr>
247                              <tr style="font-family: Tahoma">
248                                  <td align="left" colspan="4" style="height: 4px; text-align: center">
249                                      <br />
250                                      <input id="Button2" onclick="RunQuery()" onmouseout="this.style.cursor='auto'" onmouseover="this.style.cursor='pointer'; this.style.cursor='hand'"
251                                          style="border-right: #efefef thin solid; border-top: #efefef thin solid; font-size: 12px;
252                                          background-image: url(images/TDBack_Marron.gif); border-left: #efefef thin solid;
253                                          width: 100px; color: white; border-bottom: #efefef thin solid; height: 25px"
254                                          type="button" value="Run Query" /><br />
255                                  </td>
256                              </tr>
257                              <tr style="font-family: Tahoma">
258                                  <td align="left" colspan="4" style="height: 20px; text-align: center">
259                                      <div id="BusyIndicator" align="center">
260                                          <img align="middle" src="images/ajax-loader4.gif" /> </div>
261                                  </td>
262                              </tr>
263                          </tbody>
264                      </table></td>
265                  <td align="center" colspan="2" rowspan="4" style="width: 515px; text-align: left;" valign="top">
266                                                   <div id="pos" align="left"></div> <div id="vemapcontainer" class="vemapcontainer" style="left: 423px; top: 215px; height: 428px">
267                                                   <div style="text-align:right">
268                                                       <span style="font-size: 0.8em; color: #660000; font-family: Trebuchet MS">Close</span>
269                                                       <img src="images/blue_x_button.png" onclick="javascript: HideVEMap()" onmouseover="this.style.cursor='pointer'; this.style.cursor='hand'" onmouseout="this.style.cursor='auto'" border="0"/></div>   
270                                                  <div id="vemap" style=" background-color:White; width: 475px; height: 374px;"></div>
271                                                  </div>
272                                                  <script type="text/javascript">Drag.init(document.getElementById("vemapcontainer"));</script>
273                                                  <div id="Map_Panel" align="right">
274                                                  <esri:Toolbar ID="Toolbar1" runat="server" BorderColor="#EFEFEF" BorderStyle="Solid"
275                                                          BorderWidth="1px" BuddyControlType="Map" Group="Toolbar1_Group" Height="56px"
276                                                          OnCommandClick="Toolbar1_CommandClick" ToolbarItemDefaultStyle-BackColor="White"
277                                                          ToolbarItemDefaultStyle-CssClass="main9" ToolbarItemDefaultStyle-Font-Names="Trebuchet MS"
278                                                          ToolbarItemDefaultStyle-Font-Size="9pt" ToolbarItemDefaultStyle-ForeColor="Maroon"
279                                                          ToolbarItemDisabledStyle-BackColor="White" ToolbarItemDisabledStyle-Font-Names="Trebuchet MS"
280                                                          ToolbarItemDisabledStyle-Font-Size="9pt" ToolbarItemDisabledStyle-ForeColor="Maroon"
281                                                          ToolbarItemHoverStyle-BackColor="White" ToolbarItemHoverStyle-Font-Bold="True"
282                                                          ToolbarItemHoverStyle-Font-Italic="True" ToolbarItemHoverStyle-Font-Names="Trebuchet MS"
283                                                          ToolbarItemHoverStyle-Font-Size="9pt" ToolbarItemHoverStyle-ForeColor="Maroon"
284                                                          ToolbarItemSelectedStyle-BackColor="White" ToolbarItemSelectedStyle-Font-Bold="True"
285                                                          ToolbarItemSelectedStyle-Font-Names="Trebuchet MS" ToolbarItemSelectedStyle-Font-Size="9pt"
286                                                          ToolbarItemSelectedStyle-ForeColor="Maroon" WebResourceLocation="/aspnet_client/ESRI/WebADF/JavaScript"
287                                                          Width="561px">
288                                                           <ToolbarItems>
289                                                               <esri:Tool BuddyItem="Map1" ClientAction="DragRectangle" Cursor="crosshair" DefaultImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/zoomin.GIF"
290                                                                   HoverImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/zoominU.gif" JavaScriptFile="DragRectangle"
291                                                                   Name="MapZoomIn" SelectedImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/zoominD.gif"
292                                                                   ServerActionAssembly="ESRI.ArcGIS.ADF.Web.UI.WebControls" ServerActionClass="ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools.MapZoomIn"
293                                                                   Text="Zoom In" ToolTip="Zoom In" />
294                                                               <esri:Tool BuddyItem="Map1" ClientAction="DragRectangle" Cursor="crosshair" DefaultImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/zoomout.GIF"
295                                                                   HoverImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/zoomoutU.gif" JavaScriptFile="DragRectangle"
296                                                                   Name="MapZoomOut" SelectedImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/zoomoutD.gif"
297                                                                   ServerActionAssembly="ESRI.ArcGIS.ADF.Web.UI.WebControls" ServerActionClass="ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools.MapZoomOut"
298                                                                   Text="Zoom Out" ToolTip="Zoom Out" />
299                                                               <esri:Tool ClientAction="DragImage" DefaultImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/pan.gif"
300                                                                   HoverImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/panU.gif" JavaScriptFile=""
301                                                                   Name="MapPan" SelectedImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/panD.gif"
302                                                                   ServerActionAssembly="ESRI.ArcGIS.ADF.Web.UI.WebControls" ServerActionClass="ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools.MapPan"
303                                                                   Text="Pan" ToolTip="Pan" />
304                                                               <esri:Command ClientAction="" DefaultImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/fullext.gif"
305                                                                   HoverImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/fullextU.gif" JavaScriptFile=""
306                                                                   Name="MapFullExtent" SelectedImage="/aspnet_client/ESRI/WebADF/Toolbar/ArcGIS/Images/fullextD.gif"
307                                                                   ServerActionAssembly="ESRI.ArcGIS.ADF.Web.UI.WebControls" ServerActionClass="ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools.MapFullExtent"
308                                                                   Text="Full Extent" ToolTip="Full Extent" />
309                                                               <esri:Tool ClientAction="MapIdentify('Map1');" DefaultImage="~/images/identify.gif"
310                                                                   DisabledImage="~/images/identify.gif" HoverImage="~/images/identifyU.gif" JavaScriptFile=""
311                                                                   Name="MapIdentify" SelectedImage="~/images/identifyD.gif" Text="Identify" ToolTip="Identify (Ctrl-MouseClick)" />
312                                                               <esri:Tool ClientAction="startMeasure()" DefaultImage="~/images/measure.gif" HoverImage="~/images/measure.gif"
313                                                                   JavaScriptFile="" Name="Measure" SelectedImage="~/images/measure.gif" Text="Measure"
314                                                                   ToolTip="Measure" />
315                                                               <esri:Command ClientAction="GetVEMap()" DefaultImage="~/images/3globe_32.png" DisabledImage="~/images/3globe_32.png"
316                                                                   HoverImage="~/images/3globe_32H.png" JavaScriptFile="VirtualEarth.js" Name="viewVE"
317                                                                   SelectedImage="~/images/3globe_32D.png" ServerActionAssembly="App_Code" ServerActionClass="CustomJS"
318                                                                   Text="View in VE" ToolTip="View in Virtual Earth" />
319                                                          </ToolbarItems>
320                                                          <BuddyControls>
321                                                           <esri:BuddyControl Name="Map1" />
322                                                          </BuddyControls>
323                                                      </esri:Toolbar>
324                                                  <esri:Map ID="Map1" runat="server" Height="352px" MapResourceManager="MapResourceManager1"
325                                                          PrimaryMapResource="VineBasic" Width="560px" ClientToolGraphicsColor="Maroon" ImageFormat="GIF">
326                                                  </esri:Map>
327                                                       
328                                                  </div>
329      <asp:Label ID="pointinfo" runat="server" BackColor="White" Font-Bold="True" Font-Names="Arial"
330          Font-Size="8pt" ForeColor="Maroon" Width="537px"></asp:Label><br />
331                      <input id="Button4" runat="server" onmouseover="this.style.cursor='pointer'; this.style.cursor='hand'" onmouseout="this.style.cursor='auto'" style="width: 100px; border-right: #efefef thin solid; border-top: #efefef thin solid; font-size: 12px; background-image: url(images/TDBack_Marron.gif); border-left: #efefef thin solid; color: white; border-bottom: #efefef thin solid; height: 25px;" type="button" value="Reset" onserverclick="Button4_ServerClick" /></td>
332              </tr>
333              <tr>
334              </tr>
335              <tr>
336                  <td rowspan="2" style="width: 168px" valign="top">
337                  </td>
338              </tr>
339              <tr>
340              </tr>
341              <tr>
342                  <td colspan="3" width="80%" valign="top">
343          <div id="Div8">
344                  <div id="Div7" style="vertical-align: text-top;  overflow: auto; text-align: left; " align="center">
345                       
346                        <esri:FloatingPanel ID="Results" runat="server" BackColor="White" BorderColor="Silver"
347                                                  BorderStyle="Solid" BorderWidth="1px" Font-Names="Trebuchet MS" Font-Size="14px" ForeColor="Black"
348                                                   Style="; margin-bottom:0px; overflow: auto; left: 0px; top: 0px;" Draggable="False"
349                                                  Title="Map ID Results" TitleBarColor="Maroon" TitleBarHeight="20px" TitleBarSeparatorLine="True"
350                                                  Transparency="0" Font-Bold="False" CloseButton="False" TitleBarForeColor="White"
351                                                  Expanded="False" ShowDockedContextMenu="True" TitleBarBackgroundImage="images/TDBack_Marron.gif" EnableTheming="False" Height="113px" Width="100%" WidthResizable="False">
352                              <esri:TaskResults ID="TaskResults1" runat="server" BackColor="#ffffff" Font-Names="Verdana"
353                                  Font-Size="8pt" ForeColor="Maroon" ShowClearAllButton="True" Height="88px" Width="100%" />
354                               </esri:FloatingPanel>
355                        <esri:FloatingPanel ID="QueryResults" runat="server" BackColor="White" BorderColor="Silver"
356                                                  BorderStyle="Solid" BorderWidth="1px" Font-Names="Trebuchet MS" Font-Size="14px" ForeColor="Black"
357                                                   Style="; margin-bottom:0px; overflow: auto; left: 1px; top: 0px;" Draggable="False"
358                                                  Title="Query Results" TitleBarColor="White" TitleBarHeight="20px" TitleBarSeparatorLine="True"
359                                                  Transparency="0" Font-Bold="False" CloseButton="False" TitleBarForeColor="White"
360                                                  Expanded="False" ShowDockedContextMenu="True" TitleBarBackgroundImage="images/TDBack_Marron.gif" EnableTheming="False" Height="263px" WidthResizable="False" TitleBarCssClass="QueryResults" UseDefaultWebResources="False" Width="100%">
361                               
362                                
363                              <div id="griddiv" style="visibility:visible">
364          <asp:GridView ID="GridView2" runat="server" Height="35px" Width="100%"  HorizontalAlign="Center" OnPageIndexChanging="GridView2_PageIndexChanging" OnSelectedIndexChanged="GridView2_SelectedIndexChanged" EnableTheming="False" AllowPaging="True" Font-Size="10px" Font-Strikeout="False" >
365              <PagerSettings Position="TopAndBottom" />
366              <Columns>
367                  <asp:CommandField ShowSelectButton="True" ButtonType="Button" >
368                      <ControlStyle BackColor="Maroon" BorderColor="WhiteSmoke" BorderStyle="Solid" BorderWidth="1px"
369                          ForeColor="White" />
370                  </asp:CommandField>
371              </Columns>
372              <SelectedRowStyle BackColor="Gold" />
373              <PagerStyle Font-Names="Trebuchet MS" />
374              <HeaderStyle BackColor="#E0E0E0" Font-Names="Trebuchet MS" Font-Size="10px" ForeColor="Maroon" Font-Bold="False" Font-Strikeout="False" />
375              <AlternatingRowStyle BackColor="White" />
376          </asp:GridView>
377                                   </div>
378                                  <asp:Label ID="noitemslbl" runat="server" Font-Names="Trebuchet MS" Font-Size="10pt"
379                                      ForeColor="#990000" Text="No Records Found." Visible="False" Width="409px"></asp:Label> <br />
380                            <asp:Button ID="Button1" runat="server" BackColor="Maroon" BorderColor="WhiteSmoke"
381                                                  BorderStyle="Outset" BorderWidth="1px" OnClick="Button1_Click" Text="Export to Excel"
382                                                  Width="100px" Font-Size="11px" ForeColor="White" Height="23px" UseSubmitBehavior="False" /></esri:FloatingPanel>
383                            </div> 
384          </div>
385                  </td>
386              </tr>
387              <tr>
388                  <td colspan="3" align="left">
389                  </td>
390              </tr>
391          </table>
392   
393      </div>
394        <div id="footer" style="width: 735px">
395            <div class="fotext" align="center">
396               <a href="http://www.iagt.org" target="_blank"> <img src="images/iagt_logo_100.png" alt="The Institute for the Application of Geospatial Technology" border="0" /></a>  
397                  
398                      <a href="http://www.cornell.edu" target="_blank"> <img src="images/Cornell_Logo.png" alt="Cornell University" border="0" /></a>   
399                      <a href="http://www.newyorkwines.org" target="_blank"> <img src="images/nyswgf_logo.png" alt="New York State Wine and Grape Foundation" border="0" /></a><br /> 
400                <br />
401                Copyright © 2008. Design by <a href="http://www.iagt.org" target="_blank" title="IAGT">
402                    IAGT</a>   
403            </div>
404        </div>
405  </div>          
406          
407  
408          <br />
409          <br />   
410  <div id="maplayers" class="dropshadow" style="left: 14px; width: 222px; visibility:hidden; ; top: 190px; height: 439px;">
411  <div class="dropshadowcontent">
412              <table cellpadding="0" cellspacing="0" style="width: 210px; height: 406px">
413                  <tr>
414                      <td background="images/TDBack_Marron.gif" colspan="3" style="color: white;">
415                          <strong> Map Layers</strong></td>
416                      <td background="images/TDBack_Marron.gif" colspan="1" style="width: 8px;
417                          color: white; text-align: right;" align="right">
418                          <img  src="images/dismiss.png" onclick="HideTOC()" onmouseover="this.style.cursor='pointer'; this.style.cursor='hand'" onmouseout="this.style.cursor='auto'" /></td>
419                  </tr>
420                  <tr>
421                      <td colspan="4" style="height: 100%" valign="top">
422                          <esri:Toc ID="Toc1" runat="server" BorderColor="White" BorderStyle="Solid" BorderWidth="5px"
423                              BuddyControl="Map1" Font-Size="10px" ForeColor="#404040" Height="396px" SelectedColor="Maroon"
424                              ShowResourceCheckBoxes="False" TocType="LayerList" Width="193px" BackColor="White" />
425                      </td>
426                  </tr>
427              </table>
428  </div>
429  <div class="dropshadowtop"> </div>
430  <div class="dropshadowleft"> </div>
431  </div>  
432         
433          <esri:MapResourceManager ID="MapResourceManager1" runat="server">
434              <ResourceItems>
435                  <esri:MapResourceItem Definition="<Definition DataSourceDefinition="In Memory" DataSourceType="GraphicsLayer" Identity="" ResourceDefinition="" DataSourceShared="True" />"
436                      DisplaySettings="visible=True:transparency=0:mime=False:imgFormat=PNG32:height=100:width=100:dpi=96:color=White:transbg=False:displayInToc=False"
437                      Name="MapGraphics" />
438                  <esri:MapResourceItem Definition="<Definition DataSourceDefinition="In Memory" DataSourceType="GraphicsLayer" Identity="" ResourceDefinition="" DataSourceShared="True" />"
439                      DisplaySettings="visible=True:transparency=0:mime=False:imgFormat=PNG24:height=100:width=100:dpi=96:color=White:transbg=False:displayInToc=False"
440                      Name="Graphics2" />
441                  <esri:MapResourceItem Definition="<Definition DataSourceDefinition="http://vineyard.iagt.org" DataSourceType="ArcIMS" Identity="" ResourceDefinition="FLOverview" DataSourceShared="True" />"
442                      DisplaySettings="visible=True:transparency=0:mime=True:imgFormat=PNG8:height=100:width=100:dpi=96:color=:transbg=False:displayInToc=True"
443                      Name="Vineyards" />
444              </ResourceItems>
445          </esri:MapResourceManager>
446                          <esri:taskmanager id="TaskManager2" runat="server" font-names="Verdana" font-size="8pt"
447                              forecolor="Black" height="1px" width="200px"></esri:taskmanager>
448                          <asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>
449                          <asp:HiddenField ID="hfx" runat="server" />
450                          <asp:HiddenField ID="hfy" runat="server" />
451                                        
452                                                 
453             <uc1:Measure id="Measure1" runat="server" AreaUnits="Sq_Miles" MapBuddyId="Map1"
454                  MapUnits="Resource_Default" MeasureUnits="Miles" NumberDecimals="3" >
455              </uc1:Measure>
456          <script language="javascript" type="text/javascript">
457           setPageElementSizes();
458      </script><DIV ID="testdiv1" STYLE=";visibility:hidden;background-color:white; background-color:white;"></DIV>
459  <div style="z-index: 999">
460          <ajaxToolkit:CalendarExtender ID="CalendarExtender7" runat="server" PopupButtonID="Img1" TargetControlID="stb" >
461          </ajaxToolkit:CalendarExtender></div>
462      </form>
463  <script language="javascript" type="text/javascript">
464          newLoad = <%= m_newLoad %>; 
465          webMapAppCloseCallback = "<%= m_closeOutCallback %>";
466          webMapAppCopyrightCallback = "<%= m_copyrightCallback %>";
467          startUp(); 
468          </script> 
469    
470  <script language="javascript" type="text/javascript">
471  
472        
473          function showBusyIndicator(sender) {
474            // alert(m.posLeft);
475              showLayer("BusyIndicator");
476              var d = document.getElementById("BusyIndicator").style;
477              var m = document.getElementById("Map1").style;
478              
479              d.posTop = m.posTop + 200;
480              d.posLeft = m.posLeft + 100;
481              if (sender!=null) {
482  
483                  window.status = "Pending Tiles: " + sender.pendingTiles.length; 
484  
485              }  
486  
487          }
488          function showPendingTiles(sender) {
489  
490              if (sender!=null) {
491  
492                  window.status = "Pending Tiles: " + sender.pendingTiles.length; 
493  
494              }  
495  
496          }
497  
498          
499  
500          function hideBusyIndicator(sender) {
501  
502              hideLayer("BusyIndicator");
503  
504              if (sender!=null) {
505  
506                  window.status = ""; 
507                  
508              }  
509              showFloatingPanel('QueryResults');
510          } 
511  
512          
513  
514          // add busy indicator functions to the map
515  
516          map = Maps["Map1"];
517  
518          map.pendingTiles.add_onRequestsPending(showBusyIndicator);
519  
520          map.pendingTiles.add_onRequestsRemove(showPendingTiles);
521  
522          map.pendingTiles.add_onRequestsCompleted(hideBusyIndicator);    
523  
524          
525  
526     </script>
527  <SCRIPT LANGUAGE="JavaScript" ID="js15">
528  var cal15 = new CalendarPopup();
529  cal15.setReturnFunction("setMultipleValues4");
530  function setMultipleValues4(y,m,d) {
531   document.forms[0].date15_year.value=y;
532   document.forms[0].date15_month.selectedIndex=m;
533   for (var i=0; i<document.forms[0].date15_date.options.length; i++) {
534       if (document.forms[0].date15_date.options[i].value==d) {
535           document.forms[0].date15_date.selectedIndex=i;
536           }
537       }
538   }
539  var cal16 = new CalendarPopup();
540  cal16.setReturnFunction("setMultipleValues5");
541  function setMultipleValues5(y,m,d) {
542   document.forms[0].date16_year.value=y;
543   document.forms[0].date16_month.selectedIndex=m;
544   for (var i=0; i<DOCUMENT.FORMS[0].DATE16_DATE.OPTIONS.LENGTH; id=545 545          if (document.forms[0].date16_date.options[i].value==d) {
546           document.forms[0].date16_date.selectedIndex=i;
547           }
548       }
549   }
550  function getDateString(y_obj,m_obj,d_obj) {
551   var y = y_obj.options[y_obj.selectedIndex].value;
552   var m = m_obj.options[m_obj.selectedIndex].value;
553   var d = d_obj.options[d_obj.selectedIndex].value;
554   if (y=="" || m=="") { return null; }
555   if (d=="") { d=1; }
556   return str= y+'-'+m+'-'+d;
557   }
558  function SetQT(id, value)
559  {
560          var i=0;
561          for (i=1;i<=3;i++)
562          {
563          
564              document.getElementById('Radio'+ i).checked = '';
565               
566          }
567       showBusyIndicator();
568       var message ="SetQuery" + ',' + value;
569       <%=sADFCallBackFunctionInvocation%> 
570      
571          document.getElementById(id).checked ='checked';
572  
573  }
574  
575  </SCRIPT> id=576 576  </body>
577  </html>
578  

 


Thursday, September 18, 2008 12:40 PM

I found that moving the javascript with the embedded <% %> tags from the head to the form tag fixes this error.


Tuesday, June 16, 2009 3:15 AM

Thanks a lot for nice tip


Saturday, November 14, 2009 8:09 PM

One more "thank you"! 

This thing could have spent me days to find out.


Wednesday, December 16, 2009 2:18 AM

<body id="bodyInternet" > <form id="Form2" method="post" runat="server">
 

<asp:scriptManager ID="scriptManager1" runat="server" EnablePartialRendering="True"
  EnableScriptGlobalization="true" EnableScriptLocalization="true" />

<%= CssLink %>

which was placed in the <head> of the masterpage.

I placed it after the <form> and now it works fine 

 

 

<body id="bodyInternet" > <form id="Form2" method="post" runat="server">

 

<asp:scriptManager ID="scriptManager1" runat="server" EnablePartialRendering="True"

 

EnableScriptGlobalization="true" EnableScriptLocalization="true" />

<%

= CssLink %>


Wednesday, June 30, 2010 9:42 AM

i have applied all the solution provided but couldn't resolve the problem

 

There is no script masterpage or nothing like <%= %>

i have moved all the js and css links within form tag but still no luck.

 

The stack trace of the error is as follows:

at System.Web.UI.ControlCollection.RemoveAt(Int32 index)
   at System.Web.UI.ControlCollection.Remove(Control value)
   at System.Web.UI.Control.AddedControl(Control control, Int32 index)
   at System.Web.UI.ControlCollection.Add(Control child)
   at Trade_Feedback.OnAjaxUpdate(Object sender, ToolTipUpdateEventArgs args) in D:\CVS Beckett\Encore\Encore.WWW\Trade\Feedback.aspx.cs:line 131
   at Telerik.Web.UI.RadToolTipManager.OnAjaxUpdate(ToolTipUpdateEventArgs e)
   at Telerik.Web.UI.RadToolTipManager.LoadClientState(Dictionary`2 clientState)
   at Telerik.Web.UI.RadWebControl.LoadPostData(String postDataKey, NameValueCollection postCollection)
   at Telerik.Web.UI.RadWebControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
   at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 


Wednesday, June 30, 2010 9:43 AM

i have applied all the solution provided but couldn't resolve the problem

 

There is no script masterpage or nothing like <%= %>

i have moved all the js and css links within form tag but still no luck.

 

The stack trace of the error is as follows:

at System.Web.UI.ControlCollection.RemoveAt(Int32 index)
   at System.Web.UI.ControlCollection.Remove(Control value)
   at System.Web.UI.Control.AddedControl(Control control, Int32 index)
   at System.Web.UI.ControlCollection.Add(Control child)
   at Trade_Feedback.OnAjaxUpdate(Object sender, ToolTipUpdateEventArgs args) in D:\CVS Beckett\Encore\Encore.WWW\Trade\Feedback.aspx.cs:line 131
   at Telerik.Web.UI.RadToolTipManager.OnAjaxUpdate(ToolTipUpdateEventArgs e)
   at Telerik.Web.UI.RadToolTipManager.LoadClientState(Dictionary`2 clientState)
   at Telerik.Web.UI.RadWebControl.LoadPostData(String postDataKey, NameValueCollection postCollection)
   at Telerik.Web.UI.RadWebControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
   at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

Thanks,

Puru


Wednesday, June 30, 2010 3:40 PM

My aspx code HTML looks like

<html xmlns="http://www.w3.org/1999/xhtml">
    <head id="HEAD1" runat="server">
        <title>my page</title>
     <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"/>
    </head>
             <%= CssLink %>
    <body id="bodyInternet" >
  <form id="Form2" method="post" runat="server">

........................

    </form>
 </body>
</html>

 

My code page looks like

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim script1 As String
        script1 = HttpContext.Current.Session("StijlScript")
        CssLink = script1
    End Sub

 

before this I filled my session with the string

"<style type='text/css'>
 .alfabet {  background:#AAAAAA   ; }
 BODY  {     
  background-repeat:no-repeat;  
  border: 1; 
  vertical-align:top;  
  white-space:nowrap;   }  
  
 TABLE  {  font-size:x-small;  vertical-align:top;  border:0;border-style:solid;margin:0;padding:0;border-spacing:0;  border-color:red;  }
 TD  {  vertical-align:top; /*labels ed en de items in het datagrid*/  border: 0; border-style:solid;  border-color:green;  }  
</style>"

 

 


Thursday, July 1, 2010 3:47 AM

I have solved it myself.

I was looking at the masterpage and the usercontrol which is getting added but never thought that the page on which i am adding the usercontrol might have problem.

 

There was a script which was outside RadCodeBlock that was causing the issue because it is using server control. When i moved it to RadCodeBlock it solved the issue.

 

 


Thursday, August 25, 2011 11:34 PM

here is my code of the entire page without master page....i am trying a validate some fields of the form on a button click and i am getting the same error dont know why
can anyone please help me out in this ?

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="reservation.aspx.vb" Inherits="reservation" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>Anchorage Inn - Reservation</title>
    <link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
    
    <!--[if IE 6]>
        <link rel="stylesheet" href="css/ie.css" type="text/css" media="all" />   
    <![endif]-->
    
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
    
    <script type="text/javascript" src="js/jquery.jcarousel.js"></script>
    <script language="javascript" type="text/javascript" src="js/datetimepicker.js"></script>
    
    <!-- Cufon -->
    <script type="text/javascript" src="js/cufon-yui.js"></script>
    
    <script type="text/javascript" src="js/MyriadPro.font.js"></script>
    <script type="text/javascript" src="js/ArialBold.font.js"></script>
    <script type="text/javascript" src="js/jquery-func.js"></script>
    <link rel="shortcut icon" type="image/x-icon" href="css/images/favicon.ico" />

    <script type="text/javascript" language="javascript">
        //Disable right click 
        var message = "";
        function clickIE() { if (document.all) { (message); return false; } }
        function clickNS(e) {
            if
(document.layers || (document.getElementById && !document.all)) {
                if (e.which == 2 || e.which == 3) { (message); return false; }
            }
        }
        if (document.layers)
        { document.captureEvents(Event.MOUSEDOWN); document.onmousedown = clickNS; }
        else { document.onmouseup = clickNS; document.oncontextmenu = clickIE; }

        document.oncontextmenu = new Function("return false")
</script>


    <style type="text/css">
        .style1
        {
            width: 960px;
            margin: 0 auto;
            ;
            text-align: center;
            top: 0px;
            left: 0px;
        }
        .style2
        {
            font-size: 30px;
            text-align: center;
            color:White;
            font-family: Pristina;
        }
        
        .style3
        {
            text-align: center;
        }
        
        .style4
        {
            width: 103%;
        }
        .style5
        {
            font-weight: bold;
            font-size: 15px;
        }
    </style>
    
   <script language="javascript" type="text/javascript">
       function ValidateAllData() {
           if (document.getElementById("<%=txt_cin.ClientID %>").value = "") {
               alert('Please enter a Project name');
               document.getElementById("txt_cin.CLientID").focus();
               return false;
           }

           if (document.getElementById("<%=txt_cout.CLientID%>").value = "") {
               alert('Please enter a Start date');
               document.getElementById("txt_cout.CLientID").focus();
               return false;
           }

           var startDate = new Date(document.getElementById("<%=txt_cin.ClientID%>").value);
           var endDate = new Date(document.getElementById("<%=this.txt_cout.CLientID%>").value);


           if (startDate > endDate) {
               alert("Project Start date cannot be greater than Completion Date.Please check");
               document.getElementById("txt_cout.CLientID").focus();
               return false;

           }
       }
</script>

</head>
<body>
<!-- Header -->
<div id="header">
    <div class="style1">
        <!-- Logo -->
        <!-- <h4 id="logo"><a href="#">Hotel Template - free website templates</a></h4> -->
        <!-- /Logo -->
        
        <!-- Navigation -->
        <div id="navigation">
            <ul>
                <li><a href="index.aspx">HOME</a></li>
                <li><a href="about.aspx">ABOUT</a></li>
                <li><a href="#">GALLERY</a></li>
                <li><a href="#" class="active">RESERVATION</a></li>
                <li><a href="location.aspx">LOCATION</a></li>
                <li><a href="contact.aspx">CONTACT</a></li>
                <li><a href="accommodation.aspx">ACCOMMODATION</a></li>
            </ul>
        </div>
        <!-- /Navigation -->
        </div>
</div>
<!-- /Header -->

<div id="page_title" class="style2">                                
<strong><span class="style2">Room Availability Search, Reservation Guidelines</span></strong>
</div>

<!-- Main -->
<form id="reservation" runat="server" method="post">
<div id="main">
    <div class="shell">
        <!-- Box -->
        <div class="box_loc">
            <h4 class="style3">Search Availability<asp:ToolkitScriptManager 
                    ID="ToolkitScriptManager1" runat="server">
                </asp:ToolkitScriptManager>
            </h4>
            
            <div class="entry">
                <table class="style4">
                    <tr>
                        <td class="style5">
                            <asp:Label ID="lbl_cin" runat="server" Text="Check In Date"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txt_cin" runat="server" Width="124px"></asp:TextBox>
                          <asp:CalendarExtender ID="txt_cin_cal" runat="server" Enabled="True" 
                                TargetControlID="txt_cin" Format="dd/MM/yyyy" TodaysDateFormat=" MMMM,d, yyyy">
                            </asp:CalendarExtender>

                            <asp:Image ID="img_cin" runat="server" ImageUrl="~/css/images/cal.gif" Height="16px"/>

                        </td>
                    </tr>
                    <tr>
                        <td class="style5">
                            <asp:Label ID="lbl_cout" runat="server" Text="Check Out Date"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="txt_cout" runat="server" Width="124px" Height="16px"></asp:TextBox>
                             <asp:CalendarExtender ID="txt_cout_cal" runat="server" Enabled="True" 
                                TargetControlID="txt_cout" Format="dd/MM/yyyy" TodaysDateFormat=" MMMM,d, yyyy">
                            </asp:CalendarExtender>
                            <asp:Image ID="img_cout" runat="server" ImageUrl="~/css/images/cal.gif"/>
                        </td>
                    </tr>
                    <tr>
                        <td class="style5">
                            <asp:Label ID="lbl_adult" runat="server" Text="Adults"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="dd_adult" runat="server" Height="22px" Width="84px">
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="style5">
                            <asp:Label ID="lbl_child" runat="server" Text="Children"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="dd_child" runat="server" Height="22px" Width="84px">
                                <asp:ListItem>0</asp:ListItem>
                                <asp:ListItem>1</asp:ListItem>
                                <asp:ListItem>2</asp:ListItem>
                                <asp:ListItem>3</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="style5">
                            <asp:Label ID="lbl_room_type" runat="server" Text="Type Of Room"></asp:Label>
                        </td>
                        <td>
                            <asp:DropDownList ID="dd_type" runat="server" Height="22px" Width="84px">
                                <asp:ListItem Value="1">Deluxe</asp:ListItem>
                                <asp:ListItem Value="2">Suite</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="style5">
                            <asp:HiddenField ID="hd_isavailable" runat="server" />
                        </td>
                        <td>
                                <asp:Button ID="cmdSearch" runat="server" BackColor="#272728" BorderStyle="Solid" 
                                BorderWidth="2px" Font-Bold="True" Font-Names="Arial" Font-Underline="True" 
                                ForeColor="White" Height="26px" Text="Search" Width="84px" 
                                tooltip="Search Availability"  OnClick="cmdSearch_Click" OnClientClick="return ValidateAllData();"/>
                            </td>
                    </tr>
                    <tr>
                        <td class="style5">
                            <asp:HiddenField ID="hd_rate_ep" runat="server" />
                        </td>
                        <td>
                                <asp:HiddenField ID="hd_rate_cp" runat="server" />
                            </td>
                    </tr>
                    <tr>
                        <td class="style5">
                            <asp:HiddenField ID="hd_rate_map" runat="server" />
                        </td>
                        <td>
                                <asp:HiddenField ID="hd_rate_ap" runat="server" />
                            </td>
                    </tr>
                    <tr>
                        <td class="style5">
                            <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
                        </td>
                        <td>
                                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                            </td>
                    </tr>
                    </table>
                    
                
            </div>    
        </div>

        <div class="box_loc last-box">
            <h4 class="style3">Guidelines for Reservation</h4>
            
            <div class="entry bullet-list">
            <p>Reservation can be done through the below mentioned modes, but to confirm the</p>
            <p>rooms you need to make 100% advance payment of the total charges,and at the rest</p>
            <p>of the payment is to be dome on or before the  guest leaves the hotel.</p>
            <br />
            <p><strong>Cancellation Policy :-</strong></p>

                <ul>
                    <li>100% as retention will be charges if cancelled between 1-3 days before check-in date 
                        .</li>
                    <li>30% as retention will be charges if cancelled between 3-15 days before check-in date</a>.</li>
                    <li>25% as retention will be charges if cancelled between 15-20 days before check-in date</a>.</li>
                    <li>No amount shall be charges if cancelled between 20 days before check-in date</a>.</li>
                </ul>

            </div>
            
        </div>
        <!-- /Box -->
        <div class="cl">&nbsp;</div>
    </div>
</div>
</form>
<!-- /Main -->

<!-- Footer -->
<div id="footer">
    <div class="shell">
        <!-- Mini Nav --> 
        <div class="footer-navigation"> 
            <ul> 
                <li><a href="index.aspx">Home</a></li> 
                <li><a href="about.aspx">About</a></li> 
                <li><a href="#">Gallery</a></li> 
                <li><a href="#">Reservation</a></li> 
                <li><a href="location.aspx">Location</a></li> 
                <li><a href="accommodation.aspx">Accommodation</a></li> 
                <li><a href="login.aspx">Login</a></li> 
                <li class="last"><a href="#">Contact</a></li> 
            </ul> 
        </div> 
        <!-- /Mini Nav --> 
        
        <!-- Copyrights --> 
        <p class="right"> 
            Copyright 2011 | 
            Anchorage Inn. Designed by <a href="mailto:[email protected]"/> Saneed
        </p> 
        <!-- /Copyrights --> 

        <div class="cl">&nbsp;</div> 
    </div>
</div>
                                         
<!-- /Footer -->
</body>
</html>