Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET AJAX : Dynamically Pushed JavaScript not working after being pushed to UpdatePanel's content

Reply
Thread Tools

ASP.NET AJAX : Dynamically Pushed JavaScript not working after being pushed to UpdatePanel's content

 
 
Arachnid
Guest
Posts: n/a
 
      10-05-2007
Hi all,

I am trying something using ASP.NET AJAX.
Using postback i am adding a JavaScript snippet and a DIV inside a
panel in UPdatePanel.The HTML is shown. The Javascript is written too.
But JavaScript is not working.

</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="FusionCharts.js" />
</Scripts>
</asp:ScriptManager>

</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<script language="javascript" type="text/javascript">
var XML="<chart/>";
</script>

<aspanel ID="p" runat="server" Height="262px"
Width="341px">
please click on the button</aspanel>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>


<asp:UpdateProgress ID="UpdateProgress1" runat="server"
DisplayAfter="0">
<ProgressTemplate>
delay............................
</ProgressTemplate>
</asp:UpdateProgress>
</form>
<script language="javascript" type="text/javascript">
function pageLoad(){
alert($get('p').innerHTML);
}

</script>

</body>
</HTML>
---------------- CODE BEHIND --------------------

protected void Button1_Click(object sender, EventArgs e)
{
string str = "<div id='Update'>HI</div>";
str += "<script language='Javascript' type='text/
javascript'>document.getElementById('Update').inne rHTML='latest
updated hiiiiiiiiiiii!!!';</script>";
System.Threading.Thread.Sleep(3000);
p.Controls.Add(new LiteralControl(str));

}

================================================== ===============

I am using the general ScriptManager coltrol and UpdatePanel that has
a PANEL having an id 'p'.
>From the server side postback i am changing this panel's HTML to


<div id='Update'>Hi</div><script language='Javascript' type='text/
javascript'> document.getElementById('Update').innerHTML='lates t
updated hiiiiiiiiiiii!!!';</script>

I can see the div being parsed by the browser. But the <script> is not
taken care of by the browser.


PLease, please, please help me out of this.

Am i going wrong somewhere? IS there any way out?

Please help me.


- Arachnid

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
float problem, second of two boxes is being pushed down when openingfavoritesIE/or left bar in Opera shajnday HTML 23 10-20-2011 07:21 PM
float problem, on of two boxes is being pushed down when openingfavoritesIE/or left bar in Opera shajnday HTML 0 10-14-2011 07:37 PM
IE8 now being pushed at Microsoft Update Sites cwdjrxyz HTML 0 04-28-2009 09:12 PM
Footer not being pushed to bottom in CSS layout Chris HTML 5 02-21-2007 11:22 PM
Button not being pushed on Enter tshad ASP .Net 2 08-11-2005 11:32 PM



Advertisments