RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working! RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
Go Back  Xtreme Visual Basic Talk > > > RegisterClientScriptBlock not working!


Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2010, 02:21 PM
JustAGuy JustAGuy is offline
Centurion
 
Join Date: Jul 2003
Posts: 193
Default RegisterClientScriptBlock not working!


Hi,

This is really driving me CRAZY!
I have found the 'solution' for the problem on Google, but for any reason that I cannot see it simply doesn't work for me.

Ok, I have this chat client side implementation in C# code behind. In the main chat browser page there is a DIV identificated as chat_area, where all the messages (from operator as well client) are shown. The problem is that this DIV is a textarea, and I would like that it would scroll down after each contents update.

Ok, I know that I can do that with a simple Javascript like this:

Code:
document.getElementById('chat_area').scrollTop = document.getElementById('chat_area').scrollHeight;
Also, I have a timer to update the page each nnn seconds, so the natural logic is that the chat_area be scrolled down AFTER to be updated. In this case, I should have the Javascript implemented through the C# code behind, and be invoked in the tick event of the timer. Then, I have the following code:

At my chat.aspx page -

Code:
<asp:Timer ID="tmrUpdateChat" runat="server" Interval="2000" ontick="tmrUpdateChat_Tick"></asp:Timer>
At my chat.aspx.cs page -

Code:
protected void tmrUpdateChat_Tick(object sender, EventArgs e)
{
	chat_Area.innerHTML += "new text<br>";
	// since I couldn't make it work with the actual code, I did that just to see if the JS would run!
	string myscript = "alert('Helllo');";
	Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "myscript", myscript, true);
{
The case is that it is not working. The Tick event of tmrUpdateChat is being raised, but the JS inside is being ignored. The new text is being added each new Tick, but the JS script is simply being overrided.

What I am doing wrong????
__________________
Visit my business at http://www.ballooncreator.com - Software Tool For Party Balloons Online Design!

Last edited by JustAGuy; 06-11-2010 at 11:04 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working! RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working! RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
 
RegisterClientScriptBlock not working!
RegisterClientScriptBlock not working!
 
-->