Showing posts with label literal. Show all posts
Showing posts with label literal. Show all posts

Saturday, March 24, 2012

Literal Control Update Panel IE6

I have two buttons and a literal control placed inside an update panel which is sitting inside of a Drag Panel which is inside of some animation to display the initial panel. In IE7, everything works properly - when you click a button to refresh the image being drawn in the literal control, the button's text in changed to "Processing..." and then, when the response is obtained, the image is refreshed and the button's text is reverted back to its original state.

In IE7, however, the button works fine but the image never refreshs - even though I am re-writing the Literal upon postback. It is almost as if IE is caching the image. Does anybody know how to correct this issue?

Thanks!

In IE7 there is the animation disable by default, you can enable that in options.

Literal nested in UpdatePanel error: "Object reference not set to an instance of an object

I am trying to set the content of a literal which is nested inside an UpdatePanel. But when I try to reference the Literal control, I get this message: "Object reference not set to an instance of an object." This despite the fact that the name shows in Intellisense. Actually, not entirely true. It sometimes isn't showing in Intellisense, for reasons I can't fathom. But I'm not getting a compilation error, so I assume it does recognise the name, but for some reason the object is null. Here's the code:

 <asp:UpdatePanel runat="server" ID="UpdatePanel1" EnableViewState ="true" Visible="true" RenderMode="Block" UpdateMode="Conditional"> <asp:ContentTemplate> <div style="width:350px; height:400px" class="newscontent"> <asp:Literal runat="server" ID="litContent"></asp:Literal> </div> </asp:ContentTemplate> </asp:UpdatePanel>

C#:

protected void Refresh(Object Sender, RepeaterCommandEventArgs e) {if (e.CommandName=="GetContent") {int id = Convert.ToInt32((e.CommandArgument)); ObjectModel.News item =new ObjectModel.News(id); litContent.Text = item.Content; litContent.Text += DisplayDocuments(id); UpdatePanel1.Update(); } }
The Refresh function is triggered by the user clicking on a LinkButton in a repeater, but this is irrelevant to the problem, since I get the same error message if I put a simple line of code in the page load function to set the text property on the the literal.

just yesterday got same problem with accordion control and textbox

spend about 3 hours here how it goes :UpdatePanel1 onpage load or on page init try this code

///////////////////////////////////////////////////////////////////////////

Literal litContent=newLiteral();

litContent= UpdatePanel1.FindControl ("litContent") asLiteral;

////////////////////////////////////////////////////


Sol90046:

just yesterday got same problem with accordion control and textbox

spend about 3 hours here how it goes :UpdatePanel1 onpage load or on page init try this code

///////////////////////////////////////////////////////////////////////////

Literal litContent=newLiteral();

litContent= UpdatePanel1.FindControl ("litContent") asLiteral;

////////////////////////////////////////////////////

Thank you! This worked as far as eliminating my error message went. But even though the code now appears to be doing what it is told, i.e., I can step through it in debug mode and the text property of the Literal is being set to the correct content, the update panel is not displaying the results. It also appears to be doing a full page refresh rather than a partial one. I do have a scriptmanager on the page with EnablePartialRendering set to true.