.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

JavaScript Unable To Reload On UpdatePanel Asynchrouns Return

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
I have a simple code that sets the text of a Literal Control to a javascript I want it to run on each asynchronous request.But, the javascript runs only in the first request. The .cs and .aspx code are listed belo:javaScriptUpdatePanel.aspx<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="javaScriptUpdatePanel.aspx.cs" Inherits="userControlRepository.javaScriptUpdatePanel" %><!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 runat="server">    <title>Untitled Page</title></head><body>    <form id="form1" runat="server">        <asp:ScriptManager ID="ScriptManager1" runat="server">        </asp:ScriptManager>        <asp:UpdatePanel ID="UpdatePanel1" runat="server">                        <ContentTemplate>                &nbs

View Complete Post

More Related Resource Links

Run a javascript function after UpdatePanel.Update()


I thought that adding the javascript within the ContentTemplate would cause it to run every time the UpdatePanel was updated.  For example, I would assume that for the following:

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional" >
        Hello from inside the update panel!!!!
        <asp:Button ID="foo" runat="server" OnClick="foo_Click" Text="Click me to postback!" />
        <script type="text/javascript">alert('Javascript, baby!');</script>

 would cause the function alert() to run every time the UpdatePanel returns from the button click.  This is not the case, however.

How do I do this?  My update panel contains a scrolling Div and I

return class to javascript from webservice?

Hi,I know i've seen a tutorial for this, but can't locate it anymore. I have a class Employee in c# side, I also have a webservice where I pass in an ID# and an Employee object is returned. Now I want this object returned to Javascript code, I know I've seen it done before, can someone point me to a tutorial that shows something like this being done. I'm using the MicrosoftAjax.js file.Thanks.

UpdatePanel, Button and Javascript Messagebox

Hi,  In my VS 2008 C# net web page, I have some TextBoxes and a Button in an UpdatePanel.The Button's click event will do the Update work to SQL Server.The Update is working, but I would like to have a message box popping out if the Update to SQL Server is successful.How do I do that?  " src="http://forums.asp.net/emoticons/emotion-8.gif">Thanks for help. Jason

return false in javascript



<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="changeText(); return false;" />
<script type="text/javascript">
<script type="text/javascript"> function confirmDelete() { if (confirm("Yes")) return true; else return false; }
Here in both cases what will return false do
function confirmDelete()

Sharepoint 2007 View, append url with Javascript and reload page


Hi all. I have an odd requirement.

I have created a number of views for a custom list I have created. I need to be able to filter these lists by what "Quarter" we are currently in (Jan-Mar - 1; Apr-Jun - 2; Jul Sep - 3; Oct-Dec -4) compared to when the item was created (i have a calculated column that uses the created date to have the quarter). Each view is a new page (as you have created a view from within Shaarepoint)

I haven't been able to work out how to do this in the CAML query (as I can't figure out how to reference todays date in CAML).

With this out of the question, I then tried to use the Today column hack, but as this isn't dynamic, this doesn't work.

My final efforts now revolve around using a basic javascript function to append my url with the following:

?FilterField1=CreatedQuarter&FilterValue1="+ currentQuarter;

Updating an ASP.NET CheckBoxList inside an UpdatePanel from a Javascript function



I have a asp.net listbox server control that is connected to a jquery plugin that can handle a client side click event for each of the checkboxes it renders.

Whenever I click on a checkbox the click event gets triggered and I make a call to

__doPostBack("UpdatePanel1"""); so that i can update the updatepanel and rebind the checkboxlist inside it.

is it possible to do the rebind first, and then update the updatepanel? how do i do that? because now, the rebind happens on the second time i click on the checkbox.




    <script type="text/javascript">
        $(function () {

Capture large text return from Javascript function


I have a Javascript function that writes a large scale of text into a div for now, but then I need to capture the text and use it in code behind. I tried to use hidden field but it has size limit so it didn't work.  The text is shown in the page, but when I view source, there is no text in the div so I couldn't use code behind to read the text from the div even though runat is server because the text is always empty. Any suggestions? Thanks!!!

Unable to call javascript function through button's click



i have a javascript function that is placed in a separete file.There are some other functions also.

On a Button's OnClientClick i want to call a javascript function, but it is not called.When i put the same function in my aspx page that function is called. So how can i call that function which is placed in another .js file.

I  have taken some other controls like radio button , that is working fine when i call some functions  that is placed in the same .js file.

I have written like this in Button's OnClintClick property:



How can i return a value from a simple WebForm.aspx to javascript code.


Hi Experts.

How can solve this problem; Suppose you write a simple JavaScript code in form tag like this:

<script  language="javascript">

                Var type="100";

                Var result = ';

Var iframe = '<iframe src="WebForm1.aspx?"t=' + type + '"></iframe>';

Document.write(iframe);           // call WebForm1.aspx in iframe tag

Document.write(result);            //write the result that return from WebForm1.aspx


I want return the value from WebForm1.aspx and save it in result variable. How can I do?How can i return a value from WebForm1.aspx and save it in result variable?

With Regards.Mojtaba

dynamic javascript of an .ascx control inside an updatepanel not changing on client between async po


I have a confusing state issue. I found a way around it, but I would like to know why this is happening. First of all, I am using .NET 3.5 and that can't change right now (an easy fix may be the fixed ID capabilities of .NET 4.0).

Type csType = this.GetType();
ClientScriptManager cs = Page.ClientScript;
string jScriptBlockName = "SignUpSignInNameAvailabilityScript";
if (!cs.IsClientScriptBlockRegistered(csType, jScriptBlockName))
{   //NOTE: verified code always enters this
    StringBuilder cstext2 = new StringBuilder();
    cstext2.Append("function GetSignUpSignInNameAvailabilityMessage() { var id = '"
          + CreateUserWizardStep1.ContentTemplateContainer.FindControl("iSignUpSignInNameAvailabilityMessage").ClientID
          + "'; alert(id); return id; }");
    cs.RegisterClientScriptBlock(csType, jScriptBlockName, cstext2.ToString(), true);

This code is in Page_Load of an ascx. The same control is drawn on two separate postbacks of an UpdatePanel in different places of the page thus giving them different client IDs. The code works correctly on the first refresh of web browser; but after UpdatePanel

LinkButton inside UpdatePanel not executing onClick javascript



So, I have a MasterPage, in which I have an ImageButton and an UpdatePanel. Inside the UpdatePanel I have a LinkButton.

<asp:ImageButton ID="imgPdf" runat="server" ImageUrl="~/Images/pdf.png" OnClick="LnkRelease1_Click" ToolTip="Document1.pdf" Width="31px" />

<asp:UpdatePanel ID="UpdatePanel9" runat="server">                                                                                    

<asp:LinkButton ID="LnkRelease1" runat="server" OnClick="LnkRelease1_Click" ToolTip="Document1.pdf" Font-Underline="false">View Pdf</asp:LinkButton>



As you can see, both components are asociated to the same OnClick event, which should open said PDF document in a new window
using javascript (Code Behind of the MasterPage):

protected void LnkRelease1_Click(object sender, EventArgs e)
     try {   if ((((System.Web.UI.WebControls.WebControl)(sender))).ToolTip != "") { string script = @"

Javascript Error using UpdatePanel/TabContainer


Hi all,

I am developing a website with AJAX technologies: UpdatePanel/TabContainer, within a SmartPart in MOSS 2007 with ASP.NET/C#. The problem i am getting is:

Detalles de error de página webAgente de usuario: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)Fecha: Thu, 15 Apr 2010 09:38:39 UTCMensaje: Sys.InvalidOperationException: Type AjaxControlToolkit.BoxSide has already been registered.Línea: 2417Carácter: 41Código: 0URI: http://SERVER/ScriptResource.axd?d=uzsIWp-LVCpswy-cYxY6F0kaYLhLubKRZyqE7KF9iAu_g2a_jBCyn5b-toZkPJyDe_WK1FaDUH1_u80tuXtpvCHjXtXNROZdha41ueeSeDk1&t=633524895900156250Mensaje: Sys.ScriptLoadFailedException: The script '/ScriptResource.axd?d=DzHfp8F4M5iTOnENR9JnReXLIfaXEnnk8vO2d2Ogb_mDtPMz_Ao50HYTPQ9MFbyiKGHEAwJ9M3heDHI3Tuc_oObIa_HdyU2EBVk_NuOzq5zrgSzS2HqD5OEZnEeR8k_30&t=634021768372647500' failed to load. Check for: Inaccessible path. Script errors. (IE) Enable 'Display a notification about every script error' under advanced settings. Missing call to Sys.Application.notifyScript

Javascript allert inside AJAX UpdatePanel not working


I am having problems with alert box not popup when I'm using AJAX UpdatePanel. The following is what I have and it's not working.

1    ClientScriptManager csm = Page.ClientScript;
3    if(!csm.IsStartupScriptRegistered(this.GetType(), "winPop"))
4    {
5    	csm.RegisterStartupScript(this.GetType(), "winPop", "alert('Update is successful');", true);
6    }

I have to stress that the reason why it does not work is because I'm using AJAX UpdatePanel. If I turned off the AJAX UpdatePanel then it works perfectly. So does anyone have solution to go around this AJAX UpdatePanel issue?

Should I use an updatepanel and timer OR javascript for this? Will this stress the server?


I need to show the current server time on the site I am working on. I figure I can either go the route of the update panel with a timer that updates each second or simply populate a javascript with the time when page created.

I think for accuracy reasons, the timer would be better, but if I go this route, how much stress will this casue the server with 1000's of users online? Will this small ajax update cause stress on a server? 

javascript, return button properties


I thought this would be something very straight forward but I can't figure it out.

How do I return current values from a button for example button text or whether it's enabled to use in an IF statement?

This is just an example to show what I mean, but say we've got 3 buttons... The first button runs the javascript function to find out the status of the second button (whether it's enabled or disabled) and if it's disabled for example, the function will then disable the third button.

The way I tried to do it was...

<script type="text/javascript">

var btn1 = document.getElementById("Button1");

var btn2 = document.getElementById("Button2");

var btn3 = document.getElementById("Button3");

function buttonfunction() {

if (btn2.disabled = "true") {

btn3.disabled = true;




But this just seems to set btn2 to disabled every time rather than just check the status and then therefore always disables the third button?


call JavaScript that has Return Value to C# (.cs File)


hai guys...i got trouble with javascript , please help me up to solve this problem

i have a javascript to check is client file exist in the client folder like this : 

function FileExists(strURL) {
    var x = new ActiveXObject("Scripting.FileSystemObject");
    return  x.FileExists(strURL);

this function will call in server side , but im getting trouble how to call that function in server side , some function in cs will consume that js function before loading image , so that function will check in the client file the file exist or not , if exist i will load the image from the local file

please help me guys....thx for ur help

regards angela.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend