ASP Menu 4.0 AJAX client failed to load - ajax

I have a simple ASP.NET 4.0 site (no MVC). Just a Master page containing header, menu and footer. I added the script manager in the Master page too. The menu is an ASP.NET Menu control. Everything is OK on my development machine, but as soon as I move it to the GoDaddy server, the menu stops working. This is a dynamic menu loaded from a sitemap.
My problem is that the first time I load it, it just doesn't work. I always get an 'AJAX client-side framework failed to load error' and the "hover" doesn't work. But as soon as I click on one menu item, it changes the page and everything works fine afterward.
I tried a lot of things that I found here and there on the Internet. I put an EnablePartialRendering="True" to my ScriptManager, I added some code to manage ".axd" html handlers. But none of that seems to work.
Here's the code for the menu (test not final so still messy) :
<asp:Menu ID="mnuGauche" runat="server" DataSourceID="sitemap" BackColor="Transparent" RenderingMode="Table"
DynamicHorizontalOffset="0" Font-Names="Arial Black" Font-Size="small"
ForeColor="#7C6F57" Width="100%" Height="20px"
style="margin-left: 0px" Orientation="Horizontal" StaticEnableDefaultPopOutImage="false">
<StaticSelectedStyle BackColor="#5D7B9D" ForeColor="White" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DynamicMenuStyle CssClass="MenuDynamique" />
<DynamicSelectedStyle BackColor="#5D7B9D" ForeColor="White" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" Font-Size="small" />
<StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
</asp:Menu>
In my Web.config file, the only thing special that I have is :
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Altough there's plenty of stuff on the web, nothing seems to really work for this menu control. Wich is kind of bizarre because it's one from Microsoft themself. Can anyone help me on that one ?

Related

Telerik control events always being triggered

I'm using the Telerik combo box to create cascading multi-select drop down lists.
I have several drop down lists on the page ddlProject, ddlUnit, ddlDiscipline, ddlDocType.
I am using the Telerik RadAjaxManager to trigger the updates of the controls and the markup of this is as follows:
<telerik:RadAjaxManager ID="ajaxManager" runat="server" DefaultLoadingPanelID="lpnlLoading" >
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="ddlProject" EventName="TextChanged">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ddlUnit" UpdatePanelRenderMode="Inline"/>
<telerik:AjaxUpdatedControl ControlID="ddlDiscipline" UpdatePanelRenderMode="Inline" />
<telerik:AjaxUpdatedControl ControlID="ddlDocType" UpdatePanelRenderMode="Inline" />
<telerik:AjaxUpdatedControl ControlID="ddlPhase" UpdatePanelRenderMode="Inline" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="ddlUnit" EventName="TextChanged" >
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ddlDocType" UpdatePanelRenderMode="Inline" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="ddlDiscipline" EventName="TextChanged">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ddlDocType" UpdatePanelRenderMode="Inline" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
ddlProject updates ddlUnit, ddlDiscipline and ddlDocType.
ddlUnit and ddlDiscipline are only meant to update ddlDocType but I am finding that the TextChanged event is being fired when either of these controls is changed.
I've tried commenting out the Ajax Manager to see if ddlProject_TextChanged is being called and it's not, only when the Ajax Manager is on the page. I would like the Ajax Manager to be enabled to suppress the page postbacks plus it displays a loading panel for each of the comb boxes which I think gives good user experience showing when they are loading.
All this is within a user control because I want to use it on multiple pages.
Can someone please help with a solution to stop ddlProject_TextChanged being fired when unit and discipline are changed?
Thanks in advance
Andy
Edit:
I've just discovered that it might not be the AjaxManager. The control events seem to be getting fired every time the page does a post back. I also have a standard ASP.NET button which on click does not databind to any of the checkboxes, it just processes the selected values in the user control. It's even external to the user control which contains the combo boxes.
Combobox structure:
<telerik:RadComboBox ID="ddlUnit" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true"
MaxHeight="450px" Width="300px" DataTextField="Value" DataValueField="Key" Label="Unit:"
LabelCssClass="HeaderLabel" DropDownWidth="600px" Height="400px"
AutoPostBack="true" OnTextChanged="ddlUnit_TextChanged">
</telerik:RadComboBox>
TextChanged event
protected void ddlDiscipline_TextChanged(object sender, EventArgs e)
{
CTRmDataService ctrmDS = new CTRmDataService();
this.ddlDocType.DataSource = ctrmDS.GetDocumentTypesForProjectsDisciplineAndUnit(GetSelectedProjects(),
GetSelectedDisciplines(),
GetSelectedUnits(),
LoggedOnUser.Id);
this.ddlDocType.DataBind();
}
I've just been informed by Telerik that this is a bug and has been passed over to their development team.
Not necessarily a working answer but explains why I'm having the problems.
Not sure this will help at all but in our instance the issue was down to the IIS server caching content that has an adverse effect on Telerik controls. It only became apparent to us when we switched out web.config settings from debug="true" to debug="false" as this then allowed IIS to enable its caching and other related optimizations, turning all caching off in the browser for some reason still broke the controls, however turning it off in IIS or turning it back onto debug mode solved it.

IIS7: Content-Length Mismatch Due to URL Rewrite and OutboundRules Usage

I'm having some issues getting the outbound rules configured to work on IIS7, here's the scenario that's giving me grief. My ultimate goal is to get any outboundRules working within a couple of browsers. For this example, I'm using the rule that strips .aspx from various HTML tags.
Scenario 1 (Content-Length Mismatch):
To get that particular rule to work in IIS7, I had to disable dynamic compression and turn caching off by default. I was successful in getting the HTML rewritten, but another issue cropped up that makes this unusable.
When trying the rewrite content with outboundrules, I'm getting an issue where by Chrome and Firefox are performing a continuous load because of a "content-length mismatch" in the headers (Thanks Fiddler for helping me identify it). The rewrite works, but it causes the content length to be incorrect and so those two browsers look like they're loading forever. Chrome in particular this causes an issue because javascript appears to be hung up and so anything jquery doesn't work until someone physically hits the stop button.
This is the pertinent sections of the web.config that I began with in order to give me that scenario:
<system.webServer>
<rewrite>
<urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" />
<modules runAllManagedModulesForAllRequests="true" />
<outboundRules>
<rule name="Remove .aspx from links in the response" preCondition="IsHTML" stopProcessing="false">
<match filterByTags="A, Area, Base, Form, Frame, IFrame, Link, Img, Script" pattern="(.*)\.aspx(\?.*)?$" />
<action type="Rewrite" value="{R:1}{R:2}" />
</rule>
<preConditions>
<preCondition name="IsHTML">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
<caching enabled="false" enableKernelCache="false" />
</system.webServer>
While researching this issue, I found this stackedoverflow question which mentioned the rewriteBeforeCache="true" attribute on the outboundRules tag as well as this blog post which laid out the same thing that I was running into with the content-length issues.
If I modify that attribute, that leads me to Outbound Rules failing to work any further.
Scenario 2 (Outbound Rules do not work):
So because of the prior information, I began tweaking the web.config and was able to resolve the content-length mismatch by using the rewriteBeforeCache attribute on the outboundRules tag. To get that attribute to work, I was able to turn caching back on. That fixed the reponse-length mismatch from Scenario 1, but now none of the outboundRules\rule elements appear to work. I have tried a number of the simplest rules and they function just fine when I remove the rewriteBeforeCache attribute, but that causes Scenario 1:
<system.webServer>
<rewrite>
<urlCompression doStaticCompression="false" doDynamicCompression="true" dynamicCompressionBeforeCache="false" />
<modules runAllManagedModulesForAllRequests="true" />
<outboundRules rewriteBeforeCache="true">
<rule name="Remove .aspx from links in the response" preCondition="IsHTML" stopProcessing="false">
<match filterByTags="A, Area, Base, Form, Frame, IFrame, Link, Img, Script" pattern="(.*)\.aspx(\?.*)?$" />
<action type="Rewrite" value="{R:1}{R:2}" />
</rule>
<preConditions>
<preCondition name="IsHTML">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
</system.webServer>
Scenario 1 causes one error with browsers in IIS7; Scenario 2 causes outboundrules to stop working.
I have modified any number of options with disabling caching, chunk-mode transfers, and trying every combination I can think to try.
Additional notes on AppPool: IIS7, .NET4.0, Classic pipeline
Does anyone else have any ideas as to what other options I have to address this beyond moving to an IIS7.5 server?

"Submit"s don't work after setting up <httpRuntime maxRequestLength />

I needed to upload rather big file(s) to the server, so I added
<httpRuntime maxRequestLength="51200" />
to Web.Config file. After that I managed to upload needed file. But the problem is that after I added <httpRuntime maxRequestLength="51200" /> all other Submits began to result in sending empty http requests to the servers. At least it looks like that (Opera dragonfly showed empty http request, but debugger didn't react to the breakpoint placed inside the controller, which must've happened; and no errors were displayed by opera).
I've got two forms on the same page, so this is why it didn't work. After I removed one, everything started to work.

Cannot Add User Control to AJAX Toolkit TabContainer

I have a user control called "Request" that I am able to display outside of a TabContainer on my SharePoint 2010 application page. So the following works:
<UserControl:Request ID="Request1" runat="server" />
<Ajax:TabContainer ID="TabContainer1" runat="server" ScrollBars="None" Enabled="true">
<Ajax:TabPanel ID="TabPanel1" runat="server" HeaderText="Request">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label">Mylabel</asp:Label>
</ContentTemplate>
</Ajax:TabPanel>
</Ajax:TabContainer>
However, if I merely move the UserControl line into the ContentTemplate section, replacing the existing Label control, the page bombs out with a runtime error and "Request failed".
The workaround for me was to COPY, not MOVE, the user control into the ContentTemplate section, then give the copy a different ID and set the original (which I don't need) to visible="false". I have no idea why this works and it looks like a bug to me. If anyone can explain it, please do so...

Firefox not rendering contents of a Update panel

Why does the following code perform a partial render in IE but not in FF?
In FF, the time on the outside of the updatepanel will also refresh, not so in IE.
<form id="form1" runat="server">
<div>
<%=DateTime.Now.ToLongTimeString() %>
</div>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<p>New time is <%=DateTime.Now.ToLongTimeString() %></p>
<asp:Button ID="Button1" runat="server" Text="Go get it" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
</form>
Can I know what version of Firefox you are using?
I tested this on Firefox 3.0 and Firefox 3.5 (clean install - no addons).
If I click the button only the new time refreshes, the outer time doesn't. So the partial rendering works.
If you are on Firefox 3.0 or 3.5 can you create a new firefox profile to test this?.
Oleg's comment about the EventName attribute on the AsyncPostBackTrigger is likely correct. However, I would add that the Triggers do not need to be explicitly defined in this case since the Button is contained in the UpdatePanel. Events from contained elements trigger the Async Postback by default so it's unnecessary.
You've got javascript disabled in FF and it's performing a full postback. :-)

Resources