Hi,
I cannot reproduce this problem. My test code:
Aspx:
<asp:ScriptMana ger ID="ScriptManag er1" runat="server">
</asp:ScriptManag er>
<asp:UpdatePane l ID="UpdatePanel 1" runat="server">
<ContentTemplat e>
<asp:Panel ID="Panel1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Change
Control"
onclick="Button 1_Click" />
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label>
</asp:Panel>
</ContentTemplate >
</asp:UpdatePanel >
Aspx.cs:
protected void Page_PreRender( object sender, EventArgs e)
{
if (!IsPostBack)
{
ScriptManager.R egisterStartupS cript(this.Upda tePanel1,
typeof(UpdatePa nel), "allen"," <script type='text/javascript'>
alert(document. getElementById( '" +
this.Label1.Cli entID + "').tagName )</script>", false);
}
}
protected void Button1_Click(o bject sender, EventArgs e)
{
TextBox t=new TextBox();
this.Panel1.Con trols.Clear();
this.Panel1.Con trols.Add(t);
t.ID = "TextBox1";
ScriptManager.R egisterStartupS cript(this.Upda tePanel1,
typeof(UpdatePa nel), "allen"," <script type='text/javascript'>
alert(document. getElementById( '" + t.ClientID + "').tagName )</script>",
false);
}
In the first page load you can see the message box showing "SPAN". If you
click the button you'll see "INPUT".
Could you test my code? Look forward to your test result.
Regards,
Allen Chen
Microsoft Online Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Thread-Topic: Update Panel not updating DOM
| thread-index: Ackqtv8n/5lXEfiiTgmq62x9 4GasSw==
| X-WBNR-Posting-Host: 207.46.192.207
| From: =?Utf-8?B?TUNN?= <MC*@newsgroup. nospam>
| Subject: Update Panel not updating DOM
| Date: Fri, 10 Oct 2008 02:03:01 -0700
| Lines: 20
| Message-ID: <50************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3119
| Newsgroups: microsoft.publi c.dotnet.genera l
| Path: TK2MSFTNGHUB02. phx.gbl
| Xref: TK2MSFTNGHUB02. phx.gbl microsoft.publi c.dotnet.genera l:23096
| NNTP-Posting-Host: tk2msftibfm01.p hx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
|
| I have an asp.net page that contains an update panel. Within the update
| panel, controls get added dynamically. During partial page post backs the
| controls within the panel will change.
|
| I have a javascript function that uses the ClientID of the dynamic
controls
| to perform certain operations on the client-side. With each partial page
post
| back, I dynamically recreate the javascript function using the ClientIDs
of
| the newly added controls. I use ScriptManager.R egisterStartupS cript to
add
| the newly created script to the page.
|
| Using debug, I stepped through and I can see that the controls and
| javascript are all getting created correctly.
|
| The javascript function runs correctly on the initial page load. But, on
a
| partial page postback, it is throwing a null exception in the client
| javascript because it is searching for a ClientID that does not exist.
|
| The DOM does not get updated with the new ClientIDs.
|
| How can I force the DOM to update on a partial page postback?
|