The scenario:
I have a button that when clicked sets a cookie value.
On page load, I read this cookie value and write out some specific HTML.
The catch:
It appears that the buttonHandler executes AFTER the page load on the
postback.
As such, my page is 'one refresh' behind. In otherwords, If I hit the button
to set the cookie, when the page loads, it hasn't 'taken' the new setting
yet since it loaded before the cookie was set.
To get around this, after setting the value in the button handler, I then
response.redire ct back to itself. Is this the best way to handle this
problem, or is there a better way to go about this? This method seems to
work just fine, but I'm not sure if I'm committing some huge .net faux pau.
-Darrel 2 1305
You would be much better off just reading the cookie in your button click
event handler (which, as you note, runs after the page_load). It sure beats
making an extra round-trip to the server.
Travis Murray
MCSD, MCT
Artiem Consulting, Inc. http://www.artiem.com
"darrel" <no*****@hotmai l.com> wrote in message
news:u6******** ******@TK2MSFTN GP10.phx.gbl... The scenario:
I have a button that when clicked sets a cookie value.
On page load, I read this cookie value and write out some specific HTML.
The catch:
It appears that the buttonHandler executes AFTER the page load on the postback.
As such, my page is 'one refresh' behind. In otherwords, If I hit the
button to set the cookie, when the page loads, it hasn't 'taken' the new setting yet since it loaded before the cookie was set.
To get around this, after setting the value in the button handler, I then response.redire ct back to itself. Is this the best way to handle this problem, or is there a better way to go about this? This method seems to work just fine, but I'm not sure if I'm committing some huge .net faux
pau.
-Darrel
> You would be much better off just reading the cookie in your button click event handler (which, as you note, runs after the page_load). It sure
beats making an extra round-trip to the server.
Oh. Duh. Yea, that makes sense!
That said, I don't think a response.redire ct is a return to the server, is
it? From what I can tell, the redirect happens on the server end since it
happens before the page is fully rendered to be sent back to the browser. I
could be wrong about that, though.
-Darrel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ashish Shridharan |
last post by:
Hi All
I have been trying to add a control to the header cell of
a datagrid on my ASP.NET page. These controls are defined
in the HTML as ASP.NET web controls.
They are being added into the header of the datagrid in
the "ItemDataBound" method of the grid. However, once,
they are added in the grid, i seem to lose the event
handler for the same control. Is there anyone who has
tried this before and knows why this is hapenning ??
|
by: Dan Neely |
last post by:
Is it possible to override the default behavior and prevent the framework
from catching any exceptions leaving these methods and allow the app to
handle them elsewhere?
|
by: wASP |
last post by:
Hi,
I'm having a problem referencing the elements within an object
after a method of that object (a member function) has been activated
with an onsubmit handler:
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
<script language="javascript" type="text/javascript">
function js_onsubmit_hndl_fn ()
{
|
by: Sean Dockery |
last post by:
I have the following HTML file that I've been using for testing...
<html>
<head>
<script type="text/javascript">
<!--
function handleWindowLoad() {
var items = ;
for (var i = 0; i < 11; i++) {
items = "item" + (i + 1);
|
by: Nathan Sokalski |
last post by:
I add a JavaScript event handler to some of my Webcontrols using the
Attributes.Add() method as follows:
Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"
TextBox2.Attributes.Add("onKeyPress", jscode)
You will notice that jscode contains the JavaScript Logical And operator
(&&). However, ASP.NET renders this as && in the code that is
| |
by: joseph conrad |
last post by:
Hi,
I tried to implement my own session handler in order to keep control on
the process
the drawback I foun it is not creating and storing in my cookie the
PHPSESSID variable anymore.
reading te documentation it seems it should do it anyway
any advice?
|
by: Jim Davis |
last post by:
I've been happily using a custom error handler of the following form for a
while now:
window.onerror = function(Message, URL, Line) { ... }
The current case is an intranet application (support for IE 6.x is the only
browser requirement) used by a small group of people. The custom error
handler presents information about the corporate help desk and allows the
user to email the information to the support team.
|
by: Peter Oliphant |
last post by:
Note that although this involves SAPI, it is more a question about Timers
and event handlers.
I wrote a Speech Recognize handler (SAPI), and put some code in it to enable
a Timer. It would not do it. If I bring this same code outside this event
handler, it works just fine.
Is this normal?
|
by: progman417 |
last post by:
Hello,
I've got a Web User Control containing a gridview with a "select record" button on each row.
When the user clicks the button I want to call an event handler in the main page.
My problem is that the event handler hasn't been set when I check it in the GridView RowCommand event, i.e.
if (btnSelectRecordHandler != null) ...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |