473,387 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ScriptManager.RegisterClientScriptBlock not working with UpdatePanel

I have a dynamically created page. The page creates an UpdatePanel
(created at Design time) which has an ASP:Table (design time) in it.
The table has rows with a textbox (run time) that runs some Javascript
code when it is typed in.
There is also a linkbutton (run time) next to this textbox that when
clicked uses Ajax to reload the Javascript method.
However, the Javascript is not being updated.

I realize that most people post this question and the answer is "Use
ScriptManager instead of Page.ClientScript" bu tthe problem is that
I'm already using ScriptManager.

Here is my line of code:
ScriptManager.RegisterClientScriptBlock(updpnlHold er,
typeof(UpdatePanel), "AddOnLife", code, true);

I've tried registering it to the UpdatePanel, to the Page, to the
ASP:Table inside the Panel, even to the Textbox. The Textbox is the
only one that errors (saying the control must be in the Page control
tree) but the rest of them go through without erroring...but they
don't actually update the Javascript.

Anyone have any ideas?
Sep 11 '08 #1
5 13628
Hi Pselus,

How do you create the page and the update panel with the table dynamicaly,
while having them in design time? The statement seems fine to me...

Cheers,
Erjan

"Pselus" <ja****@gmail.comwrote in message
news:91**********************************@l64g2000 hse.googlegroups.com...
>I have a dynamically created page. The page creates an UpdatePanel
(created at Design time) which has an ASP:Table (design time) in it.
The table has rows with a textbox (run time) that runs some Javascript
code when it is typed in.
There is also a linkbutton (run time) next to this textbox that when
clicked uses Ajax to reload the Javascript method.
However, the Javascript is not being updated.

I realize that most people post this question and the answer is "Use
ScriptManager instead of Page.ClientScript" bu tthe problem is that
I'm already using ScriptManager.

Here is my line of code:
ScriptManager.RegisterClientScriptBlock(updpnlHold er,
typeof(UpdatePanel), "AddOnLife", code, true);

I've tried registering it to the UpdatePanel, to the Page, to the
ASP:Table inside the Panel, even to the Textbox. The Textbox is the
only one that errors (saying the control must be in the Page control
tree) but the rest of them go through without erroring...but they
don't actually update the Javascript.

Anyone have any ideas?
Sep 11 '08 #2
how do you know its not added? this stuff is easier to debug with
firefox and its dev tools (firebug and dev tool). you can see added
script and dom changes done by ajax calls.

-- bruce (sqlwork.com)

Pselus wrote:
I have a dynamically created page. The page creates an UpdatePanel
(created at Design time) which has an ASP:Table (design time) in it.
The table has rows with a textbox (run time) that runs some Javascript
code when it is typed in.
There is also a linkbutton (run time) next to this textbox that when
clicked uses Ajax to reload the Javascript method.
However, the Javascript is not being updated.

I realize that most people post this question and the answer is "Use
ScriptManager instead of Page.ClientScript" bu tthe problem is that
I'm already using ScriptManager.

Here is my line of code:
ScriptManager.RegisterClientScriptBlock(updpnlHold er,
typeof(UpdatePanel), "AddOnLife", code, true);

I've tried registering it to the UpdatePanel, to the Page, to the
ASP:Table inside the Panel, even to the Textbox. The Textbox is the
only one that errors (saying the control must be in the Page control
tree) but the rest of them go through without erroring...but they
don't actually update the Javascript.

Anyone have any ideas?
Sep 12 '08 #3
On Sep 11, 3:14*pm, "Erjan Gavalji" <erjob...@yahoo.comwrote:
Hi Pselus,

How do you create the page and the update panel with the table dynamicaly,
while having them in design time? The statement seems fine to me...

Cheers,
Erjan

"Pselus" <jam...@gmail.comwrote in message

news:91**********************************@l64g2000 hse.googlegroups.com...
I have a dynamically created page. *The page creates an UpdatePanel
(created at Design time) which has an ASP:Table (design time) in it.
The table has rows with a textbox (run time) that runs some Javascript
code when it is typed in.
There is also a linkbutton (run time) next to this textbox that when
clicked uses Ajax to reload the Javascript method.
However, the Javascript is not being updated.
I realize that most people post this question and the answer is "Use
ScriptManager instead of Page.ClientScript" bu tthe problem is that
I'm already using ScriptManager.
Here is my line of code:
ScriptManager.RegisterClientScriptBlock(updpnlHold er,
typeof(UpdatePanel), "AddOnLife", code, true);
I've tried registering it to the UpdatePanel, to the Page, to the
ASP:Table inside the Panel, even to the Textbox. *The Textbox is the
only one that errors (saying the control must be in the Page control
tree) but the rest of them go through without erroring...but they
don't actually update the Javascript.
Anyone have any ideas?
The updatepanel and table are created at design time but the table is
populated with controls at run time.
Sep 12 '08 #4
On Sep 11, 11:46*pm, bruce barker <nos...@nospam.comwrote:
how do you know its not added? this stuff is easier to debug with
firefox and its dev tools (firebug and dev tool). you can see added
script and dom changes done by ajax calls.

-- bruce (sqlwork.com)

Pselus wrote:
I have a dynamically created page. *The page creates an UpdatePanel
(created at Design time) which has an ASP:Table (design time) in it.
The table has rows with a textbox (run time) that runs some Javascript
code when it is typed in.
There is also a linkbutton (run time) next to this textbox that when
clicked uses Ajax to reload the Javascript method.
However, the Javascript is not being updated.
I realize that most people post this question and the answer is "Use
ScriptManager instead of Page.ClientScript" bu tthe problem is that
I'm already using ScriptManager.
Here is my line of code:
ScriptManager.RegisterClientScriptBlock(updpnlHold er,
typeof(UpdatePanel), "AddOnLife", code, true);
I've tried registering it to the UpdatePanel, to the Page, to the
ASP:Table inside the Panel, even to the Textbox. *The Textbox is the
only one that errors (saying the control must be in the Page control
tree) but the rest of them go through without erroring...but they
don't actually update the Javascript.
Anyone have any ideas?
I know that it hasn't changed because I can see the Javascript method
when I view the page source. It is still the same in the page source
and the outcome is still the same.
Sep 12 '08 #5
On Sep 11, 2:37*pm, Pselus <jam...@gmail.comwrote:
I have a dynamically created page. *The page creates an UpdatePanel
(created at Design time) which has an ASP:Table (design time) in it.
The table has rows with a textbox (run time) that runs some Javascript
code when it is typed in.
There is also a linkbutton (run time) next to this textbox that when
clicked uses Ajax to reload the Javascript method.
However, the Javascript is not being updated.

I realize that most people post this question and the answer is "Use
ScriptManager instead of Page.ClientScript" bu tthe problem is that
I'm already using ScriptManager.

Here is my line of code:
ScriptManager.RegisterClientScriptBlock(updpnlHold er,
typeof(UpdatePanel), "AddOnLife", code, true);

I've tried registering it to the UpdatePanel, to the Page, to the
ASP:Table inside the Panel, even to the Textbox. *The Textbox is the
only one that errors (saying the control must be in the Page control
tree) but the rest of them go through without erroring...but they
don't actually update the Javascript.

Anyone have any ideas?
I think I figured it out.
The Javascript code was being registered twice on a postback (or on an
Ajax postback). It was being registered like normal, then it went
through the code to change the Javascript code and registered it
again. The second registration wasn't being recognized.
I put a check around the first registration to check the control
causing the Postback and if it was the link that was supposed to
create the new Javascript I made sure not to register it the first
time.
Works perfectly now.
:)
Sep 12 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: MSDN | last post by:
After a postback, how do I set focus onto a control that is inside an updatepanel?
2
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have...
3
by: JacekDr | last post by:
Hello, I've got the following problem: I want to add and remove dynamically controls to UpdatePanel. In my user control I have a button, but when I click it I get AsyncPostback and Event for...
0
malav123
by: malav123 | last post by:
Hi, I am using ajax toolkit and in project i am using tabcontainer... but script manager not working in my aspx page and without script manager tab container can not be used... I am getting...
5
by: Leon Mayne | last post by:
Having a bit of trouble here. I know that if you want to use a fileupload control inside an AJAX update panel then you need to create a trigger for the control that performs the uploading postback...
1
by: Mark B | last post by:
This is my first try at using AJAX. I want the calendars to be enabled if the user checks CheckBox1. It works OK for a normal all page refresh but once I introduced the AJAX code it stopped...
3
by: =?Utf-8?B?Y21lZWsxXzE5OTk=?= | last post by:
Hello, On a webpage, create an UpdatePanel with two DropDownLists. Set AutoPostBack of DropDownList1 to true. In the SelectedIndexChanged method, refill DropDownList2 and set the focus to...
2
by: qwedster | last post by:
Folks! The following is a "Hello World" kind of code for ViewState. I just want to know how to retain the ViewState 1) while Page Refresh when using UpdatePanel and also 2) While I reverting back...
0
by: nira alex | last post by:
Hi, I have an ASP.net page with a repeater and other control. I wrote the following: ScriptManager.RegisterClientScriptBlock(this, GetType(), "test", "confirm(\"Are you sure you want to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.