473,394 Members | 1,752 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,394 software developers and data experts.

Weird Literal rendering behavior

I have a button and a literal on my page (among other things but *I think*
this functionality is pretty much isolated).

1. In Page_Init I set literal.Text = "PAGEINIT"

2. In the button's click method I set literal.Text = "BUTTONCLICKED"

3. In Page_PreRender I verify that literal.Text == "BUTTONCLICKED" after
clicking the button.

4. As soon as I step out of Page_PreRender the page is rendered with
literal.Text == "PAGEINIT"

If I specifically set literal.Text = "MANUALLYSET" in Page_PreRender, then
literal.Text == "MANUALLYSET" when the page renders. I'm stumped. Why is
the Text set in the button's click method carried through to Page_PreRender
but then not rendered in the browser? Why does manually setting the value in
Page_PreRender work when the value that is in literal.Text at the time of
Page_PreRender is ignored?

Any help is greatly appreciated as I'm about to lose it...
Mar 19 '08 #1
2 1214
Scott,
This really belongs in the asp.net newsgroup, not the "C# Language" group.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"Scott L" wrote:
I have a button and a literal on my page (among other things but *I think*
this functionality is pretty much isolated).

1. In Page_Init I set literal.Text = "PAGEINIT"

2. In the button's click method I set literal.Text = "BUTTONCLICKED"

3. In Page_PreRender I verify that literal.Text == "BUTTONCLICKED" after
clicking the button.

4. As soon as I step out of Page_PreRender the page is rendered with
literal.Text == "PAGEINIT"

If I specifically set literal.Text = "MANUALLYSET" in Page_PreRender, then
literal.Text == "MANUALLYSET" when the page renders. I'm stumped. Why is
the Text set in the button's click method carried through to Page_PreRender
but then not rendered in the browser? Why does manually setting the value in
Page_PreRender work when the value that is in literal.Text at the time of
Page_PreRender is ignored?

Any help is greatly appreciated as I'm about to lose it...
Mar 20 '08 #2
You're right, my bad. If anyone cares, it turns out that implementing a
partial page update in ASP.NET webforms can cause unexpected behavior in
unrelated parts of the page. Lame.

"Peter Bromberg [C# MVP]" wrote:
Scott,
This really belongs in the asp.net newsgroup, not the "C# Language" group.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"Scott L" wrote:
I have a button and a literal on my page (among other things but *I think*
this functionality is pretty much isolated).

1. In Page_Init I set literal.Text = "PAGEINIT"

2. In the button's click method I set literal.Text = "BUTTONCLICKED"

3. In Page_PreRender I verify that literal.Text == "BUTTONCLICKED" after
clicking the button.

4. As soon as I step out of Page_PreRender the page is rendered with
literal.Text == "PAGEINIT"

If I specifically set literal.Text = "MANUALLYSET" in Page_PreRender, then
literal.Text == "MANUALLYSET" when the page renders. I'm stumped. Why is
the Text set in the button's click method carried through to Page_PreRender
but then not rendered in the browser? Why does manually setting the value in
Page_PreRender work when the value that is in literal.Text at the time of
Page_PreRender is ignored?

Any help is greatly appreciated as I'm about to lose it...
Mar 20 '08 #3

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

Similar topics

6
by: David Opstad | last post by:
I have a question about text rendering I'm hoping someone here can answer. Is there a way of doing linguistically correct rendering of Unicode strings in Python? In simple cases like Latin or...
2
by: Martin Doyle | last post by:
Ok, I'm building a JS-based limitless-sublevel dynamic menu and am making it cross browser as well - 3 packs of aspirin so far and counting ;) I'm having a weird rendering problem using Opera...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
14
by: Joe | last post by:
Hello All: I am trying to dynamically populate a web page with literal content and controls (textboxes and checkboxes (and eventually two buttons - the buttons do not appear in the code yet). I...
5
by: George Jordanov Ivanov | last post by:
All, Today I was playing with Literal control. Basically it is more or less like the Label control with this difference that Literal control is something like "lightweight" text container (that...
17
by: lovecreatesbeauty | last post by:
1. In the following code, is the code (line 11) legal? Is there a notice in the document to tell callers that the parameter s1 should receive an array variable, i.e. type char, but not a variable...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
28
by: entfred | last post by:
I have the following line of html:  &nbsp1234    &nbspabc  &nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd ...
5
by: polas | last post by:
Good morning, I have a quick question to clear up some confusion in my mind. I understand that using a string literal in a declaration such as char *p = "string literal" declares a pointer to...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.