Category Archives: ScriptManagerProxy

ScriptManagerProxy

[RESOLVED]JS file and master page

I have a js file with a function to return the date and time in a specific format.

I have a label in the master page where the date and time have to be showed every second.

The idea is that every content page shows the time every second too.

This is my js file

function Reloj() {

    FechaHoraSistema = new Date()

//Code to format the date and time

    return FechaCompleta
}

This is my master page

<head runat="server">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title>Info Vuelos AIJS</title>

    <!--Referencia al archivo de estilos CSS-->
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />             
        
    <!--Rerefencia al archivo Javascript (Salir del dir master y entrar al dir scripts) -->
    <script src="../Scripts/Reloj.js" type="text/javascript"></script>
   
      <!--Scripts para ejectuar localmente -->
    <script type="text/javascript" language="javascript">  

        //Funcion de reloj para mostrar la hora en un control local
        function RelojLocal() {
            document.getElementById('<%=lblTiempo.ClientID%>').innerHTML = Reloj(); //Asignar tiempo            
            setTimeout("RelojLocal()", 1000);  //Llamar a esta función cada segundo
            return false;
        }
                      
      </script> 
 
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
               
    </asp:ContentPlaceHolder>
    
</head>

<body onload="RelojLocal()"> 
 
    <form runat="server" id="form">
       
    <asp:ScriptManager runat="server">
    </asp:ScriptManager>

    <div class="page">
        <div class="header">
            <div class="title">                
                                      
                <asp:Label ID="lblTiempo" runat="server" CssClass="Reloj" Width="45%" 
                        ClientIDMode="Static"></asp:Label>
                                    
                </ContentTemplate>
                </asp:UpdatePanel>

        <div class="main">
        <asp:ContentPlaceHolder ID="MainContent" runat="server"/>            
                
   <div class="footer">
   </div>

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

This is my content page

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Master/Principal.Master" CodeBehind="LlegadasWeb.aspx.vb" Inherits="SRC_Sitio_Web.LlegadasWeb" %>
 
  <asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
       
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server" >

     <asp:UpdatePanel ID="UpdatePanelPrincipal" runat="server">
    
    <ContentTemplate> 
                                       
    </ContentTemplate>
 </asp:UpdatePanel>  

</asp:Content>

Problem

When the site is on line in the IIS of the server the content pages don’t show the time, but in the local test (F5) it works fine.

May be because of this,

 <!–Rerefencia al archivo Javascript (Salir del dir master y entrar al dir scripts) –> 
   
<script src="../Scripts/Reloj.js"
type="text/javascript"></script> 

It’s not referencing  the .js file

Use the ResolveClientUrl Method to reference the js file in the master page

src =’<%= Page.ResolveClientUrl("~/Scripts/Reloj.js") %>’

 

 

Hi,

You may have to use ScriptManagerProxy control in the Content Pages!

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanagerproxy.aspx

Hope it helps u…

[RESOLVED]selected index change event not calling in update panel in jquery dialog

Hi ,

i have placed update panel in jquery dialog. where 2 dropdown list is there.

but upon change the selected index on 1st item. nothing chaanges , it comes back to default index.

How i can solve it?

Thanks

Is your program actuall generating the event and you’re not seeing what you expect or does the event seem to be blocked from occuring?

If the later you might need to add a ScriptManagerProxy to your jquery dialog module. Also check that your dropdowns have the autopostback set to true and that it’s event is set to trigger the update panel.

[RESOLVED]Data not updated on Browser back button

Hello friends

I have found tht control which is inside the update panel will not show the updated values once used click on browser back button.

Could you please help me how i can show the updated values for control which is inside Ajax Panel

Thanks

According to your description ,I would like to suggest you to check the links below for some articles which describe how to enable Back/Forward-Button Support for ASP.NET AJAX UpdatePanel.

http://weblogs.asp.net/scottgu/archive/2006/09/14/Tip_2F00_Trick_3A00_-Enabling-Back_2F00_Forward_2D00_Button-Support-for-ASP.NET-AJAX-UpdatePanel.aspx

http://www.codeproject.com/KB/aspnet/ajaxhistorymanagement.aspx?display=Print

On your ScriptManager, you need to set EnableHistory="true". Then, on the buttons that change from page1 to page 2 (to print page #3), you have to invoke ScriptManager.GetCurrent(Page).AddHistoryPoint("KeyName", value);

This saves the back button history state.

Now you have to override the OnNavigate event of the ScriptManager (or ScriptManagerProxy if your ScriptManager is in a MasterPage). When navigating, you have to restore the user’s previous state manually.

The default behavior of the back button is what you are seeing — it goes to the previous URL loaded in the browser. When you are using UpdatePanels, this URL doesn’t change.

There are a few tutorials about this, here is one:

http://geekswithblogs.net/ranganh/archive/2008/11/17/enabling-the-browserrsquos-back-button-for-grid-view-asp.net-ajax.aspx

You can also google against ScriptManager, EnableHistory, AddHistoryPoint, and OnNavigate.

[RESOLVED]display JS message on tab control load

I have an interesting dilema. I have a user control which is being added through tab control with 2 other controls. I want to display a popup message upon user control click through tab control.

I am wondering how I can do it using mainpage.aspx, once abc.ascx control is activated.

P.S. I have tried simple popup message on abc.ascx control and it doesn’t have following method. I am stuck Please help!!!

ScriptManager.RegisterStartupScript()

ScriptManager.StartupScript()

this.gettype()

you can place scriptmanagerproxy on your user control, then you will have all the methods of scritp manager on user control

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanagerproxy.aspx

http://forums.asp.net/t/1059480.aspx/1

Use ScriptManager.RegisterStartupScript

http://asp.net/AJAX/Documentation/Live/mref/O_T_System_Web_UI_ScriptManager_RegisterStartupScript.aspx

http://asp.net/AJAX/Documentation/Live/mref/M_System_Web_UI_ScriptManager_RegisterStartupScript_5_d03cd23f.aspx

"string CloseWindow;
CloseWindow = "alert(‘Hello World’)";

ScriptManager.RegisterStartupScript(this,this.GetType(), "CloseWindow", CloseWindow, true);"

[RESOLVED]Simple & Small Calender Control for Asp.net

I dont want to use a calender control of as.net because it is too much big in size.

Rhather than, i used a Ajax Control Toolkit

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Calendar/Calendar.aspx

but it gives me error that only one instance of script manger can run.

But it is necessary to include a script manager.

Let me tell you that i am using this control inside a grid view where i am going to add a new row each time with all set of controls.

Hi,

Make sure you are using one instance of script manager.

If you are using master page, then use proxy script manager in content page.

or, use only script manager but not also toolkit manager.

Try tookit script manager

Are you using master page?

This is too big for you:

<asp:Calendar ID="Calendar1" runat="server" Font-Size="XX-Small"></asp:Calendar>

The original error message tells you that you try to have multipleScriptManger objects. Such a scenario would be present if you use a ScriptManager in the MasterPage and in a individual page that inherits the master page. To avoid this, there is <Asp:ScriptManagerProxy>
which works as another ScriptManager , though it only passes the calls to the ScriptManager object in the masterpage.

ScriptManager Control Overview

Example :

http://www.aspdotnet-suresh.com/2012/06/ajax-calendar-extender-control-example.html

http://www.codeproject.com/Questions/612564/adding-ajax-calendar-control-to-textbox-in-asp-net

[RESOLVED]microsoft jscript runtime error object expected error in update panel

i am using update Ajax update panel for retriving data , the page is in master page , its giving this error with every letter we type in the texbox.,,.

Hi,

For content pages, you should be using <asp:ScriptManagerProxy> - http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanagerproxy.aspx

Hope it helps u…

[RESOLVED]UpdatePanel + browser back button

Hi, I am not sure if this is possible but this is the scenario:

I have a menu consist of inbox and outbox and a main panel to display the list of mails, when I click on either the inbox or outbox, it does a partial postback to fetch the mails and display it in the main panel, when I click on any of the mails, it does
another partial postback to display the content of the mail just like yahoo or hotmail.

My question is when I click the back button while in the mail content, how can I direct the user back to the mail listing page instead of exit the page entirely?

Thanks.

This is often a problem you could look at the resources mentioned in the answer to this question:

How to save history within UpdatePanel?

http://forums.asp.net/t/1164675.aspx/1

According to your description ,I would like to suggest you to check the links below for some articles which describe how to enable Back/Forward-Button Support for ASP.NET AJAX UpdatePanel.

http://weblogs.asp.net/scottgu/archive/2006/09/14/Tip_2F00_Trick_3A00_-Enabling-Back_2F00_Forward_2D00_Button-Support-for-ASP.NET-AJAX-UpdatePanel.aspx

http://www.codeproject.com/KB/aspnet/ajaxhistorymanagement.aspx?display=Print

On your ScriptManager, you need to set EnableHistory="true". Then, on the buttons that change from page1 to page 2 (to print page #3), you have to invoke ScriptManager.GetCurrent(Page).AddHistoryPoint("KeyName", value);

This saves the back button history state.

Now you have to override the OnNavigate event of the ScriptManager (or ScriptManagerProxy if your ScriptManager is in a MasterPage). When navigating, you have to restore the user’s previous state manually.

The default behavior of the back button is what you are seeing — it goes to the previous URL loaded in the browser. When you are using UpdatePanels, this URL doesn’t change.

There are a few tutorials about this, here is one:

http://geekswithblogs.net/ranganh/archive/2008/11/17/enabling-the-browserrsquos-back-button-for-grid-view-asp.net-ajax.aspx

You can also google against ScriptManager, EnableHistory, AddHistoryPoint, and OnNavigate.

http://forums.asp.net/t/1867179.aspx/1?update+panel+browser+back+button

[RESOLVED]scriptmanager in a popup

can someone explain how i insert a scriptmanager tag in a piece of code that acts as a popup.

adding  TAG DOESNT WORK AS ALREADY ONE IN THE MASTER PAGe

 

thanks

 

Why do you want to insert another script manager tag if one is already there?

Hi,

in the total rendered page there’s only one scriptmanager allowed. So if your popup makes use of such a master page then you can’t put another one on top of that. However you can make use of a
scriptmanagerproxy control if you need extras on that popup instead.

Grz, Kris.

ok well the autosync postback on the dropdowns in the update panel are not working so was assuming i need to add something else to the code in addtion to the master page scriptmanager

A Web page can contain only one ScriptManager control, either directly on the page or indirectly inside a nested or parent component. The
ScriptManagerProxy control lets you add scripts and services to content pages and to user controls if the master page or host page already contains a
ScriptManager control.

When you use the ScriptManagerProxy control, you can add to the script and service collections defined by the
ScriptManager control. If you do not want to include specific scripts and services on every page that includes a particular
ScriptManager control, you can remove them from the
ScriptManager control. You can then add them to individual pages by using the
ScriptManagerProxy control instead.

http://pavanarya.wordpress.com/2011/12/26/scriptmanagerproxy-and-its-usage/

ModalPopupExtender with AutoPostBack DropDownList

No compatability with using CollapsiblePanelExtender with MasterPage

I am on visual studio 2012. I need to add in the CollapsablePanelExtender for my site. Because there is a ScriptManager on the MasterPage, I cannot figure out how I can add in the ToolkitScriptManager. When I try to use Scriptmanagerproxy, the web.config
crashes and tells me I must use ToolkitScriptManager. When I use my toolkitscriptmanager with the master page’s scriptmanager, the site also crashes and says ToolkitScriptManager cannot be found, and "only one instance of ScripManager is allowed.

I have tried many combinations such as: using ToolScriptManager on Masterpage (error: Could not load file or assembly ‘System.Web’ or one of its dependencies. The system cannot find the file specified.) Using ScriptManager (error: Web.config says I must
use ToolkitScriptManager.) using ScriptManager and ToolkitScriptManager (error: Only one instance of ScriptManager is allowed)

I can’t figure out what is causing this error, has anybody here used CollapsiblePanelExtender?

I have the following code on the masterPage

<asp:ScriptManager runat="server">
    <Scripts>
        <%--Framework Scripts--%>
        <asp:ScriptReference Name="MsAjaxBundle" />
        <asp:ScriptReference Name="jquery" />
        <asp:ScriptReference Name="jquery.ui.combined" />
        <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
        <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
        <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
        <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
        <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
        <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
        <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
        <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
        <asp:ScriptReference Name="WebFormsBundle" />
        <%--Site Scripts--%>

    </Scripts>
</asp:ScriptManager>

And I have the following code to be used in an actual page.

<asp:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server"></asp:ToolkitScriptManager>
    <h3>We suggest the following:</h3>
    <ol class="round">
        <li class="one">
            <asp:Panel ID="pnlRec" runat="server"><h5>Getting Started with Recreation</h5><br />
                <asp:Label ID="lblMsg" runat="server" Text="Label"></asp:Label></asp:Panel>
            <asp:Panel ID="cpnlRec" runat="server"><table><tr>
                    <td>Stuff</td><td>Stuff</td><td>Stuff</td>
                       </tr></table></asp:Panel>
            <asp:CollapsiblePanelExtender  ID="cpeRec" runat="server"  CollapseControlID="cpnlRec" Collapsed="True" 
                ExpandControlID="cpnlRec" CollapsedText="Show" ExpandedText="Hide" TextLabelID="lblMsg" TargetControlID="cpnlRec">

            </asp:CollapsiblePanelExtender>

charlieZL

I need to add in the CollapsablePanelExtender for my site. Because there is a ScriptManager on the MasterPage, I cannot figure out how I can add in the ToolkitScriptManager.

You don’t need script manger on content page, if you already have one on master page. 

Place Script Manager in masterpage only and remove it from your page.

You only need one script manager.

Ensure you have one and only one <asp:Scriptmanager> on the masterpage.

Ensure you also have one and only one <asp:ScriptManagerProxy> on each and every content page that might require a script manager

http://stackoverflow.com/questions/1996095/only-one-instance-of-a-scriptmanager-can-be-added-to-the-page

http://dotnetfish.blogspot.com/2007/12/only-one-instance-of-scriptmanager-can.html

I get this Error when that is done:

With only ScriptManager 

0x800a139e - Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.

With ScriptManagerProxy(same)

http://localhost:49515/ScriptResource.axd?d=HmPHS4c8DJOsyehLgTYT9ACvSFLgFIrw6CQ1zdh8uRK0kF8hCRzKtt7Fuw5PPYWgde50YZhAzwr7Cek_Q44gFSLKIn9I_zIB8SSWbcoNiRyz5ZAdMCis28H_WTI91muA0&t=7c776dc1

0x800a139e - Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.

Do you know anything about that?

charlieZL

I get this Error when that is done:

With only ScriptManager 

Replace script manager on master page with Ajax script manager

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>

I get errors for using ToolkitScriptManager in my masterpage, the function of ScriptManager and Toolkit are different

Could not load file or assembly 'System.Web' or one of its dependencies. The system cannot find the file specified.

This is what happens when I use toolscriptmanager on my master page. I don’t understand