Streamed HTML Through ASPX Literal Loads Only The First Time?

Jun 3, 2010

I am streaming HTML content into a Literal control in an ASPX page, and am continually running into a problem where the page loads fine the first time I try it, then subsequent attempts fail to load.

The purpose of the aspx page is to act as a 'broker' to another process that produces streamed HTML output, which then needs to be resolved by the browser.

The reason I'm not just using HtmlTextWriter to stream out the code to the Response object is that the streamed HTML contains framesets, and I am forbidden from modifying that code in any way, so I must keep the streamed code intact. In spite of the fact that frameset HTML hardcoded into the ASPX file would work, it does NOT resolve streamed frameset code!

In any case, streaming into the literal (by creating a string that is assigned to the Literal's Text property) works just fine -- the FIRST time I load that page. If I exit the page, then try to reinstantiate, it FAILS, producing an empty HTML file (containing only "<HTML></HTML>").

View 3 Replies


Similar Messages:

Create Set Of 10 Random Numbers Every Time Page Loads?

Jul 7, 2010

I am trying to create a Question Bank application for one of our clients. What is the main challenge I am facing is a typical demand from the client. What they want is : Whenever users open this site a set of random numbers(range say 1 to 20) should be generated and questions with the QuestionID(column in a table in Database) according to the numbers would be displayed in the page. I have done it to some extent but, still not satisfied with it.

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int[] n = new int[10];
int rn;
bool Check = true;
int[] n1 = new int[10];
Random rand = new Random();
n1[0] = rand.Next(1, 21);
for (int i = 1; i < 10; i++)
{
rn = rand.Next(1, 21);
for (int j = 0; j < n1.Length; j++)
{
if (n1[j] == rn)
{
Check = false;
break;
}
else
continue;
}
if (Check == true)
n1[i] = rn;
}
for(int i=0;i<10;i++)
Response.Write(n1[i] + " ");
}
}

Here are some O/Ps : 11 13 14 4 16 0 0 0 0 0 (1st load)
5 9 8 1 0 0 0 0 0 0 (after refreshing the page)
16 10 20 6 8 17 11 7 0 0 (after refreshing again)

I want that, all these digits in each refresh should be unique(which is comming) but all set should 10 digits(this is not happening).

View 6 Replies

C# - Telerik RadAjaxManager Loads Controls Slow The First Time?

Mar 15, 2011

So I have a RadPanelBar, and within that a RadTreeView. On a node click event I want so update some control.. for now I am just trying to update a textbox. It works fine except that the first time I click on a child node it takes a very long time to update the control.. Just a simple text change. I set a break point in my function and I noticed that it is taking long to fire the OnNodeClick event.. If I click a parent node in the tree view it loads fine on the first click. Also, after the first time I've clicked it.. it loads quickly.. If I refresh the page, it is slow on the first click again.. Is there something I am missing.. Is the structure of my HTML inappropriate for these AJAX calls? I feel like this is a really simple example that should work..

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="IncidentReportPanel">

[Code]....

EDIT: I updated my code according to this article, [URL] , and the problem persisted... again it only happens the first time..

EDIT: Just to clarify, by updating according to that article, I mean that I removed all the tables and relative widths and replaced them with css positioning and fixed widths.. the problem only happens the first time.. and it only happens sometimes.. quite a few times i thought i solved the problem as it would start responding quickly.. but then after I change my .aspx and change it back (even to the exact same thing when it was working quickly).. I get the same problem..

EDIT: So, I removed the AJAX component.. and setup the control so that it does a PostBack.. and it still takes long to hit my break point.. so it seems that its not an AJAX issue... but for some reason my events are taking long to fire..

EDIT: So I followed the advice on this post and I used the webservices to do my binding and handle everything from the client side code.. All seemed to be ok until I decided that I wanted to return nodes from my webservice that could also be expanded.. So in my webservice I set the ExpandMode of my RadTreeNodeData object to Webservice.. and it renders the data correctly when I expand the child nodes.. However now I see the same problem from before where some calls take 20-30 seconds.. It takes 20-30 seconds to even hit the break point in my webservice.. Should I use the OnClientNodeExpand event instead?

View 3 Replies

C# - Disallow Asp:Literal From Outputting HTML?

Aug 10, 2010

Is there a way to disallow the asp:Literal from outputing HTML ?

If I input the text <b>Hello world</b> I want to show it just like that, and not in bold.

If possible I don't want to extend it, because I would have to change the whole project.

View 3 Replies

Web Forms :: Want To Change Code - It Loads On Aspx Page

Sep 20, 2010

I have the following code in my aspx file

<asp:DropDownList id="lstBannerType" runat="server" CssClass="input_nosize" AutoPostBack="True" OnSelectedIndexChanged="lstBannerType_SelectedIndexChanged">
<asp:ListItem>Top banner</asp:ListItem>
<asp:ListItem>Tower banner</asp:ListItem[code]....

but want to change this so it loads in my aspx.cs page so I can wrap it in an id (!IsPostBack) statement to stop the value getting set back to Top banner when the page is refreshed

View 1 Replies

C# - ActiveX Asks User To Install Every Time Page Loads

Feb 1, 2010

I think the title says it all, I have an activeX control, that ask the user if he want's to install it every single time the page loads (Even if it is already installed). Can anyone point me in the right direction? What I have tried so far:

Setting new Guids for the class & interface.
Changing interfaces names & method names.
Changing version number
Uninstalling and re-installing the activeX

View 2 Replies

Is It Accepted Use Literal Inside Html Elements

Feb 26, 2010

recently i used literals inside HTML elements like so:

Code:
<div <asp:Literal ID="ltlpbEmpty" runat="server"></asp:Literal> align="left" <asp:Literal ID="ltlToolTip" runat="server"></asp:Literal>>
<div <asp:Literal ID="ltlPBFull" runat="server"></asp:Literal> <asp:Literal ID="ltlBarWidth" runat="server"></asp:Literal> align="left">

</div>
in this case both of this divs are part user control progress bar i'm making, from not related reason i couldn't use ASP.NET elements and had to go back to the traditional HTML elements.so to be able to give those elements dynamic attributes such as tooltip, id, class i had to add literals inside those elemtns..

View 15 Replies

Web Forms :: Literal Can't Hold HTML Code

Jan 17, 2010

My Problem Simply is when i create a Literal Control and I put at the text property Html Input

(<input type="text" name="textfield17" id="textfield17" />) and create an control button and But at the click event of the control button :

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Write(Literal1.Text)
End Sub

and When I run the application I will find at the literal control a text box when i Type any text at it and click the button it return another Literal have only Html Input control without the text it entered

View 6 Replies

GridView Paging Every Time - Change Page Loads Full Data

Oct 14, 2010

I do long and slow query to get data to my GridView and I got lot of data, but when I'm changing page it loads as slow as at the start, it loads full data again and again, how to load data once and use paging without data loading?

View 1 Replies

C# - Get Html Table Width To Fit Screen Using Literal .net Control?

Feb 24, 2011

I'm building a html table dynamically in an ASP.NET code behind file using C#. I basically loop through a set of data which is an unknown number of records and split a string containing all the values to make the required number of tds. I display the html by assigning it to an asp:Literal control. However I can't get the table to fit the screen - the browser is adding a horizontal scroll bar and the full table is well off the screen. I tried in IE 8 and FF 3.6.13. Most things I've read online about it say to set the width to 100%. I'm doing this but it's having no effect.

<div id="paging">
<asp:Button ID="btnPrev" runat="server" Text="Prev" CssClass="niceInput" onclick="btnPrev_Click" Enabled="False" />
<asp:Button ID="btnNext" runat="server" Text="Next" CssClass="niceInput" onclick="btnNext_Click" Enabled="False" />
[code]...

View 1 Replies

ASP Literal Or Page Altering HTML String Causes Formatting

Jun 16, 2010

We have a service that generates a report (using word templates and a 3rd party library), and then returns a string in HTML. While this HTML isn't great - its formatted correctly in this string. We want this HTML to show up on a page - format intact. What we currently have done is set an ASP.net Literal's text element to this string. While this works, I have noticed that it has reformatted the HTML string slightly. For the most part, it looks like it generated a bunch of new CSS classes, and a new style element in the HTML. This HTML does not exist in the string thats being returned. I could filter all of this back out, but wonder if there is a better way. I assume that the Page itself is altering something. What is the best way to display this raw HTML back to the user? I can't directly use a Response.Write(string), because this page does have a few other controls on it.

View 3 Replies

C# - How To Render HTML Entities To Normal Character Into Literal Control

Jan 14, 2011

I've these codes in my DATABASE in other words it's HTML. I tried these stuff:

<div runat="server" id="div1" visible="false">
<asp:Literal ID="literal1" runat="server" Text="" />
</div>

I tried in C# code behind:

div1.InnerText = contents;
div1.InnerHtml = contents
literal1.Text = contents;

But is still doesn't render well. I displays the original values in stead of a table and cells and columns. colours etc. etc....

What am I missing?

All these HTML's are in DABASE.Column e.g. column "Contents"
e.g.

"& lt;p class=& quot;MsoNormal" style= "color: #339966;"><"
;" ;> ;< ;strong > ;&l
ot; > ;& ;nbsp; < ;/span >< ;/p >

I've put (spaces between & and gt above code otherwise it was not showing in stackoverflow.) The HTML sysntaxs are correct because it's created by an HTMLEDITOR.

View 2 Replies

Web Forms :: Aspx Page Has No Code Being On First Loads - Display Java Script Popup

Mar 21, 2010

I am maintaining a website that has .Aspx web pages with no code behind C# files. This has been a challenge for me, because I need to do the following:

1.) When the page first loads, display a Java Script popup message box.

So how can I do this if I don not have a code behind C# file where I can check for isPostback in the on page load method? Can the on page load method be placed inline in the .aspx code? Anyway I need to figure out how to answer my question 1 above.

View 2 Replies

AJAX :: Load MS Chart Every Time When Page Loads Or Button Clicks In Update Panel

Mar 7, 2011

I have 2-3 update panel in my page and i don't want to load chart every time when my page loads or button clicks etc. I put that in update panel with triggers means only some clicks should loads chart. but that chart gets loaded everytime. how to stop that from loading

View 2 Replies

VS 2005 Make A Smart Code Where The Next User Controls Loads Instead Of The HTML?

Mar 16, 2010

I have an application where I make advanced engineering/science calculations.

The application consists of 25 equal calculation "lines" which I have made as user controls:

web form:

Code:

[code]....

However the performance is quite bad because each line load from a database. Each line becomes visible when the last line has been clicked so I only need in fact 2 lines to be loaded at the beginning.

Can I make a smart code where the next user controls loads instead of the HTML that I have made, where all 25 lines appears and loads but are not visible until the line before has been used?

View 14 Replies

C# - Save A PDF That's Been Streamed To The Browser?

May 19, 2010

I'm streaming PDFs to the browser, and it works fine. The problem is when someone clicks the save button. On the same server, we have a "Live" and a "test" site. They are identical, and I've verified that all code is identical. However I'm seeing different dialog boxes when the user clicks "Save"

Test site:
- dialog box: "Save A Copy"
- file name: "Document.pdf"
- file type: Adobe PDF

Live site:
- dialog box: "Save As..."
- file name: "Document.aspx"
- file type: Adobe PDF

To make things even more "fun" I've noticed this behavior ONLY with IE8. With Firefox or Chrome clicking save - regardless of which site (test or live) opens the "Save a Copy" dialog box which allows the users to save the file as a PDF instead of a .aspx file.

View 1 Replies

Play Streamed Audio In Browser?

Aug 25, 2010

I am trying to get this to work for quite some time now. I have an asp.net page in which I am trying to play a wav file. The code in the page load event is as follows:

Response.Clear()
Response.ContentType = "audio/wav"
Response.AppendHeader("Content-Disposition", "inline;filename=" + "temp.wav")
Dim filePath As String = Server.MapPath("/temp.wav")
If Not String.IsNullOrEmpty(filePath) Then
'Here I am converting the file to a byte array,as eventually I'll be creating the wav files on the fly
Dim fileBytes As Byte() = GetFileBytes(filePath)
Response.BinaryWrite(fileBytes)
Response.Flush()
End If

The problem I am having is every time I run this page, the windows media player opens up. I would like the audio to be played using some inbuilt plugin in the browser. Something like, when you click on a voice icon, how the sound pops up without opening any player.

If I have the same content in an ashx handler, would it be better?

I could not use the embed tag because, I shall not be having a physical file on the server, it would be generated on the fly using a response stream.

View 1 Replies

Fancybox Not Showing Streamed Image Correctly?

Jan 18, 2010

I've got an aspx page that streams jpeg's. It sets the content type and then writes to the response stream. If I view the images directly they work a treat, but if I use fancybox 1.2.6 I get the following.Using fancybox 1.2.1 the images do show.Here is the code that is pushing out the image.

using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())

[code]...

View 3 Replies

How To Open New Window With Streamed Document In Web Forms

Jan 3, 2011

I have an ASP.NET Web Forms application. I want to have a button to post back to the server that will use my fields on my form (after validation) as parameters to a server process that will generate a document and stream it back to the browser. I want the form to be updated with some status results.

What is the best way to achieve this? Right now, I've got the button click generating the document and streaming it back tot he browser (it's a Word document and the dialog pops up, and the Word document can be opened successfully) but the page doesn't get updated.

View 2 Replies

Streaming Wcf Service Returning Corrupt Streamed File?

Aug 31, 2010

I have a WCF service that returns a stream object. But for some reason i get a corrupt zip file back which i am streaming.

Contract Code

[ServiceContract(Namespace = "http://schemas.acme.it/2009/04/01")]
public interface IFileTransferService
{
[OperationContract(IsOneWay = false)]
FileDownloadReturnMessage DownloadFile(FileDownloadMessage request);

[Code].....

View 2 Replies

Forms Data Controls :: Get Html Control Of .aspx Page In .aspx.cs Control?

Aug 12, 2010

.aspx:

<input type="file" id="file1" name="file1"/>

now i want to call the file control in .aspx.vb page. how can we call this..

View 3 Replies

HTML Act Differently In Aspx And Html?

Aug 28, 2010

i want to put the text in the vertical middle of the <td>

it works fine in .html page but if i use it in .aspx, then it goes to the top of the <td>

This is the script i use

<table
border="1px">
<tr>
<td
style="height:
100px"
valign="middle">

This should be in the middle

</td>
</tr>
</table>

is there any way to put the text in the vertical middle of the <td>??

View 9 Replies

Web Forms :: How To Write Aspx Page HTML From Aspx.cs Page On Page Load

Dec 1, 2010

i want to write aspx page html from aspx.cs page on page load..

i hav already used div.innerHtml...

i want to write below code in aspx page from aspx.cs page

[code]....

View 5 Replies

Web Forms :: Schedule An ASPX Page To Run At Particular Intervals Of Time?

Feb 3, 2010

How to Schedule an ASPX Page to run at a particular intervals of time using Schedule Tasks in Control Panel"? If so can any one explain me in detail "How would I achieve that with neat steps".

View 6 Replies

Web Forms :: How To Use A CSS StyleSheet For The Aspx Page On Design Time

Feb 5, 2010

In my company we use a control that renders the <link rel="stylesheet"> tags dynamically at runtime (equivalent of scriptmanager who renders <script> tags dynamically). this control is very good, cause it select the appropriate css stylesheets depending on some criterias. The problem is that on design time for Visual Studio there is no designated CSS stylecheet since there is no <link rel="stylesheet"> tags on the page.

If I put <link rel="stylesheet"> tags on the aspx page (to indicate a design time stylesheet) this tag will be rendered to client and it causes conflicts with tags rendered by the control !

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved