Showing posts with label scriptmanager. Show all posts
Showing posts with label scriptmanager. Show all posts

Wednesday, March 28, 2012

Consistent nuisance with AjaxControlToolkit. Possible PublicKeys.

Hi.

I've been developing a web site in Visual Studio 2005. I had various problems with the Ajax Extensions such as ScriptManager and UpdatePanel. They were all of validation nature for ASP and sometimes went away without notice and sometimes opening up the Web.config was enough. Not logical to me I kept on and then finally ended up updating Visual Studio to Service Pack 1. All of the problems are now gone but then, new one surface.


Even when I make a new AjaxControlToolkit enabled web site, and just drag and drop a TextBox and AutoCompleteExtender, I get validation errors on both the AutoCompleteExtender and then the default added ToolkitScriptManager. The error I get is sometimes of the likes of

Error 34 Element'ToolkitScriptManager'is not a known element. This can occurif thereis a compilation errorin the Web site.

And yeah, the build failes. Then I get this error:

Error32Requestfor the permission of type'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
 
So, just so you know what I've tried to do to fix this. I've tried: * Searched the PublicKeyToken and changed it to all uppercase.

* Reinstalled the Ajax Extension msi
* Re-added the AjaxControlToolkit in to the Toolbox (reset it first).
* Put the Trust Level to Medium in web.config.
* Taken out PublicKeyToken on System.Web.Extensions

And this is happening to me with default values of all things. I really understand if some of you who are kind enough to try and help me can't reproduce this error but,
these errors have crippled my work for 2 days by now and it's really uncomfortible to realise that this tool that's supposed to help me is more a burden then help.
I can pass on a screenshot of this peculiar error and it's safe to say that I expected more from Microsoft.

Hi,

This seems to be a security issue, please specify trust level to FullTrust and try again.

Monday, March 26, 2012

Conflict between IE7 and AJAX update panel

I think I found a bug in Microsoft Explorer 7. When I launch a modal popupwindow or a java alert box (using ScriptManager.RegisterClientScriptBlock) from within an Update Panel, the whole screen is being pushed about 15 pixels downwards, if the page has a masterpage. It seems to work alright for pages without masterpages.

I have tested my application in IE6, IE7 and Mozilla Firefox. Internet Explorer 7 is the only browser having this issue. It doesn't matter if the update panel encapsulates just the button or everything in the content page, the problem is still there. It seems to me now that my only option is to detach all content pages with this issue from the master page by creating duplicate menus.

If anyone knows something please let me know.

Can you post some codes here??I'd?like?to?test?it?in?IF?7.0.

I discovered that the problem occurs even when a button is clicked.

Steps to replicate the error.

1. Go New Website, ASP.NET AJAX CTP enabled website/Visual Basic

2. Create MasterPage.master

3. Create Default2.aspx with MasterPage.master as masterpage

4. Copy the following block to Default.aspx(Source)

<%@. Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" title="Untitled Page" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px"> <asp:UpdatePanel id="x" runat="server"> <ContentTemplate><asp:Button id="Button1" runat="server" Text="Button" ></asp:Button> </ContentTemplate> </asp:UpdatePanel> </asp:Panel></asp:Content>

5. Copy the following block to MasterPage.master(Source)

<%@. Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Untitled Page</title> </head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ModalPopUpTestExScriptmanager" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> </asp:UpdatePanel> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder> </form></body></html>

6. Start the application and click the button. If you use IE7 as a browser the button will be relocated when you click it the first time. It works for me in Firefox and IE6.


Correction: Item no 4 should be: "4. Copy the following block to Default2.aspx(Source)" and nothing else


When I remove the update panel from the master page everything function normally. The problem seems to happen in IE7 especially when both the content page and master page have an update panel each. Personally, I don't need an update panel in my masterpage. The update panel in my masterpage was completely redundant and unnecessary. The reason I had it there at all is that I was experimenting some time ago with top menus in update panels and I must have forgotten to remove it. Thanks
I installed Visual Studio .NET 2005 with Ajax RC 1.0 and Futures Dec CTP in my PC and tested your codes in your?last?post. I?found?it?worked?fine?in?IE?7.0.
Try to add "<asp:ScriptManagerProxy runat="server"></asp:ScriptManagerProxy>" to the content page?as?the?following and check if it works.
<%@. Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" title="Untitled Page" %
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManagerProxy runat="server"></asp:ScriptManagerProxy>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
<asp:UpdatePanel id="x" runat="server">
<ContentTemplate>
<asp:Button id="Button1" runat="server" Text="Button" ></asp:Button>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</asp:Content>
Wish the above can help you.
I installed Visual Studio .NET 2005 with Ajax RC 1.0 and Futures Dec CTP in my PC and tested your codes in your?last?post. I?found?it?worked?fine?in?IE?7.0.
Try to add "<asp:ScriptManagerProxy runat="server"></asp:ScriptManagerProxy>" to the content page?as?the?following and check if it works.
<%@. Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" title="Untitled Page" %
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManagerProxy runat="server"></asp:ScriptManagerProxy>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
<asp:UpdatePanel id="x" runat="server">
<ContentTemplate>
<asp:Button id="Button1" runat="server" Text="Button" ></asp:Button>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</asp:Content>
Wish the above can help you.

Wednesday, March 21, 2012

Composite Control - ScriptManager - WebMethod

Hi!

I am working on a composite control in which I add a ScriptManager programmatically. I also have a static method exposed as [WebMethod] inside the Composite Control. I have set the script manager's EnablePageMethods=true.

I added this control to a web page, but when I run the page, it seems that the Web Method client-side scripts are not being generated. Is there a way to make this work?

Thank you!

Not directly, no. pagemethods are only available as a collection when they're written in the codefile; I'm not sure of the reasoning behind this. You have three options for composite controls aside from using UpdatePanels:

1) expose properties to let the page developer specify a web service / service method.

2) expose a property to let the page developer specify a pagemethod (this could be combined w/ #1 to let the dev. use either one)

3) use Sys.Net.WebRequest calls to the containing page, and mimic the post data that would go on a full postback. Optionally, add a custom header that tellsyour control that it's an ajax call so that you can respond with only the data instead of the whole page markup.