473,387 Members | 1,388 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.

how can write to the page after Response.End()

hi,
i'm guessing you just can't write to the page after Response.End(), but
i would be interested to hear if anyone has a work around for my
situation.

i have designed a 'SmartButton' control that disables itself (client
side) when it's clicked, and re-enables itself (client side) after it
is clicked.
the problem is when the button_click event does something like download
a file with binarywrite, this ends the Response. when this happens, my
client side code obviously doesn't get written out, and the button
stays in a disabled state with "Please wait..." as the text. i would
like the button to return to normal, so the user can click it again if
necessary.

the code for the control is below.
thanks for any tips
tim.

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace Whatever
{
/// <summary>
/// A button control that disables itself when clicked, and changes
the text to "Please wait..."
/// This is to prevent duplicate clicks by impatient or novice users.
/// </summary>
[DefaultProperty("Text"), ToolboxData("<{0}:SmartButton
runat=server></{0}:SmartButton>")]
public class SmartButton : Button
{

protected override void Render(HtmlTextWriter output)
{
string onClick = "this.form.__EVENTTARGET.value='" + this.UniqueID +
"'; this.disabled = true; this.value = 'Please wait...';
this.form.submit(); ";
this.Attributes.Add("onclick", onClick);
base.Render(output);
}

protected override void OnClick(EventArgs e)
{
base.OnClick (e);

// reset enabled state and text to the original values
HttpContext.Current.Response.Write(String.Format(@ "
<script>
if(document.getElementById('{0}') != null)
{{
document.getElementById('{0}').disabled = false;
document.getElementById('{0}').value = '{1}';
}}
</script>
", this.UniqueID, this.Text));
}
}
}

Nov 19 '05 #1
1 1645
Hi Tim,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 19 '05 #2

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

Similar topics

10
by: Greg Hurlman | last post by:
I've got what I'm sure is a very simple problem. In an ASP page, I am trying to write out 4 fields from a recordset in succession: Response.Write rs("LastName") Response.Write rs("Suffix")...
2
by: Rob McLennan - ZETLAND | last post by:
Hi, I'm relatively clueless when it comes to correct ASP syntax. I'm testing out a search form for my company's website which is done in ASP. The results are displayed as per the code shown at the...
9
by: Dominic Godin | last post by:
Hi, I have an asp page that does a lot of processing and reports it's finished by printing the word "Success". For example: <% SomeFunction(SomeVar) SomeFunction(SomeVar1) ...
0
by: anonieko | last post by:
> > > > Writing an XML document the .Net way If you've been using the .Net Framework for even a week, you know that the kids in Redmond really thought of almost everything, so they're not...
0
by: hari krishna | last post by:
hi all, My requirement is to generate xl reports throu Asp.Net without installing xl on web server computer. i am using Response object and wrtifile method as below. i dont know whether it is...
9
by: mallyonline | last post by:
I last posted to this group about 6 months ago and was very pleased by the excellent response I got and the great help offered to me. I am back this time with another request for your expert help...
1
by: Dan | last post by:
Hi I've created a generic 'Report' class that takes a DataView from a DataGrid control and writes it out to the response as a csv file for download. Basically, when a user clicks the download...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
1
by: csgraham74 | last post by:
Hi there, ive written a function to display some returned values in a table. I use response.write to write the values as html. My problem is that this has stopped working correctly and i find...
4
by: David Thielen | last post by:
Hi; I have a page where the file.aspx.cs Page_Load() method writes the entire contents out directly. I use this to write a pdf or rtf file as the web page to display. In .net 1.1 the way I...
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
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.