473,785 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrigger Postback

I want to click a button and have it does something before the page reloads.
I now realize the page processes the server side event after page loads. Is
there any way of triggering the postback twice. I know its a hack.....


Nov 19 '05 #1
8 1449
There is no sense in triggering postback twice. Could you specify more
details of what you're after?

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Read my weblog:
Followers of the IHttpHandler
http://clariusconsulting.net/vga
"Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
news:uv******** ******@TK2MSFTN GP14.phx.gbl...
I want to click a button and have it does something before the page
reloads.
I now realize the page processes the server side event after page loads.
Is
there any way of triggering the postback twice. I know its a hack.....

Nov 19 '05 #2
Chris,

if you'd tell a little more about your problem it would be easier to find a
solution regarding your problem. What you could do for example is to trigger
a webservice which could perform sth. for you in the background. But all
ideas, recommendations are most probably useless if your problem is this
vague.

Greetings
---------------------------------------
Daniel Walzenbach
MCP

www.walzenbach.net

"Chris Kennedy" <ck************ **@bleyonder.co .uk> schrieb im Newsbeitrag
news:uv******** ******@TK2MSFTN GP14.phx.gbl...
I want to click a button and have it does something before the page
reloads.
I now realize the page processes the server side event after page loads.
Is
there any way of triggering the postback twice. I know its a hack.....

Nov 19 '05 #3
I agree to Victor. Triggering postback twice is definitely no solution!

---------------------------------------
Daniel Walzenbach
MCP

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPA M.com> schrieb im Newsbeitrag
news:Ot******** ******@TK2MSFTN GP12.phx.gbl...
There is no sense in triggering postback twice. Could you specify more
details of what you're after?

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Read my weblog:
Followers of the IHttpHandler
http://clariusconsulting.net/vga
"Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
news:uv******** ******@TK2MSFTN GP14.phx.gbl...
I want to click a button and have it does something before the page
reloads.
I now realize the page processes the server side event after page loads.
Is
there any way of triggering the postback twice. I know its a hack.....


Nov 19 '05 #4
I want to press a button and have it change an XML file. Those changes need
to be place before the page loads again, specifically at the page
initialisation stage. I am using the XML file to determine which controls to
add to the page. It's really long winded to explain why I need this but
this is the order I need things executed:

Load Page with button.
Press button, amend XML file.
Postback and use changed XML file in the load event.

My understanding is the postback processing takes place AFTER the load which
is too late.

If I repost the XML will have changed and the user won't notice. Currently I
have to press the button twice for the changes in XML to show up.
If you need more info that's fine but I don't want to make things so
longwinded to put people off! Regards, Chris.
"Daniel Walzenbach" <da************ ***@newsgroup.n ospam> wrote in message
news:#j******** ******@TK2MSFTN GP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

---------------------------------------
Daniel Walzenbach
MCP

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPA M.com> schrieb im Newsbeitrag
news:Ot******** ******@TK2MSFTN GP12.phx.gbl...
There is no sense in triggering postback twice. Could you specify more
details of what you're after?

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Read my weblog:
Followers of the IHttpHandler
http://clariusconsulting.net/vga
"Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
news:uv******** ******@TK2MSFTN GP14.phx.gbl...
I want to click a button and have it does something before the page
reloads.
I now realize the page processes the server side event after page loads. Is
there any way of triggering the postback twice. I know its a hack.....



Nov 19 '05 #5
As an example of how you might want to handle the
dynamic loading of your controls:

http://www.eggheadcafe.com/articles/...xviewstate.asp

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.masterado.net

Earn $$$ money answering .NET Framework
messageboard posts at EggHeadCafe.com .
http://www.eggheadcafe.com/forums/merit.asp

"Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
news:O2******** ******@TK2MSFTN GP12.phx.gbl...
I want to press a button and have it change an XML file. Those changes need
to be place before the page loads again, specifically at the page
initialisation stage. I am using the XML file to determine which controls
to
add to the page. It's really long winded to explain why I need this but
this is the order I need things executed:

Load Page with button.
Press button, amend XML file.
Postback and use changed XML file in the load event.

My understanding is the postback processing takes place AFTER the load
which
is too late.

If I repost the XML will have changed and the user won't notice. Currently
I
have to press the button twice for the changes in XML to show up.
If you need more info that's fine but I don't want to make things so
longwinded to put people off! Regards, Chris.
"Daniel Walzenbach" <da************ ***@newsgroup.n ospam> wrote in message
news:#j******** ******@TK2MSFTN GP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

---------------------------------------
Daniel Walzenbach
MCP

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPA M.com> schrieb im Newsbeitrag
news:Ot******** ******@TK2MSFTN GP12.phx.gbl...
> There is no sense in triggering postback twice. Could you specify more
> details of what you're after?
>
> --
> Victor Garcia Aprea
> Microsoft MVP | ASP.NET
> Read my weblog:
> Followers of the IHttpHandler
> http://clariusconsulting.net/vga
>
>
> "Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
> news:uv******** ******@TK2MSFTN GP14.phx.gbl...
>>I want to click a button and have it does something before the page
>>reloads.
>> I now realize the page processes the server side event after page loads. >> Is
>> there any way of triggering the postback twice. I know its a hack.....
>>
>>
>>
>>
>
>



Nov 19 '05 #6
Hi.
This is probably not the best solution, but if you must post your page one
more time you can use a javascript.
Here is an example:
Protected WithEvents myBody As System.Web.UI.H tmlControls.Htm lGenericControl
(Remember to put runat="server" in your body tag.)

Put this code in your buttons click event.
myBody.Attribut es.Item("onLoad ") = "document.f orms[0].submit()"

Clear the onLoad event in page_load to avoid the form being posted every
time the page loads.
myBody.Attribut es.Item("onLoad ") = ""

Hope this helps,
Shawn
"Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
news:O2******** ******@TK2MSFTN GP12.phx.gbl...
I want to press a button and have it change an XML file. Those changes need to be place before the page loads again, specifically at the page
initialisation stage. I am using the XML file to determine which controls to add to the page. It's really long winded to explain why I need this but
this is the order I need things executed:

Load Page with button.
Press button, amend XML file.
Postback and use changed XML file in the load event.

My understanding is the postback processing takes place AFTER the load which is too late.

If I repost the XML will have changed and the user won't notice. Currently I have to press the button twice for the changes in XML to show up.
If you need more info that's fine but I don't want to make things so
longwinded to put people off! Regards, Chris.
"Daniel Walzenbach" <da************ ***@newsgroup.n ospam> wrote in message
news:#j******** ******@TK2MSFTN GP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

---------------------------------------
Daniel Walzenbach
MCP

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPA M.com> schrieb im Newsbeitrag
news:Ot******** ******@TK2MSFTN GP12.phx.gbl...
There is no sense in triggering postback twice. Could you specify more
details of what you're after?

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Read my weblog:
Followers of the IHttpHandler
http://clariusconsulting.net/vga
"Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
news:uv******** ******@TK2MSFTN GP14.phx.gbl...
>I want to click a button and have it does something before the page
>reloads.
> I now realize the page processes the server side event after page loads.> Is
> there any way of triggering the postback twice. I know its a hack.....>
>
>
>



Nov 19 '05 #7
Hi Chris,

Your description is still a bit vague but I think I got your scenario now.
What you're trying to do goes against the web form architecture. The logic
that will take the modified value from the Click event and will do anything
to the XML file should be placed in an event like PreRender, trying to have
this logic as early as the Init event is not good as this event and the Load
one are there mostly to recreate the state the page previously had.
Then -once the state is the same it was before postback- event will be
processed and its there where you have a chance to modify anything, just
before the page renders again.

This is usually a bit difficult to grasp at first.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Read my weblog:
Followers of the IHttpHandler
http://clariusconsulting.net/vga
"Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
news:O2******** ******@TK2MSFTN GP12.phx.gbl...
I want to press a button and have it change an XML file. Those changes need
to be place before the page loads again, specifically at the page
initialisation stage. I am using the XML file to determine which controls
to
add to the page. It's really long winded to explain why I need this but
this is the order I need things executed:

Load Page with button.
Press button, amend XML file.
Postback and use changed XML file in the load event.

My understanding is the postback processing takes place AFTER the load
which
is too late.

If I repost the XML will have changed and the user won't notice. Currently
I
have to press the button twice for the changes in XML to show up.
If you need more info that's fine but I don't want to make things so
longwinded to put people off! Regards, Chris.
"Daniel Walzenbach" <da************ ***@newsgroup.n ospam> wrote in message
news:#j******** ******@TK2MSFTN GP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

---------------------------------------
Daniel Walzenbach
MCP

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPA M.com> schrieb im Newsbeitrag
news:Ot******** ******@TK2MSFTN GP12.phx.gbl...
> There is no sense in triggering postback twice. Could you specify more
> details of what you're after?
>
> --
> Victor Garcia Aprea
> Microsoft MVP | ASP.NET
> Read my weblog:
> Followers of the IHttpHandler
> http://clariusconsulting.net/vga
>
>
> "Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
> news:uv******** ******@TK2MSFTN GP14.phx.gbl...
>>I want to click a button and have it does something before the page
>>reloads.
>> I now realize the page processes the server side event after page loads. >> Is
>> there any way of triggering the postback twice. I know its a hack.....
>>
>>
>>
>>
>
>



Nov 19 '05 #8
Chris,

I don't know if this approach is of any use in your scenario but give it a
try and let me know.

Dynamic page updates using XMLHTTP
http://support.microsoft.com/kb/893659/en-us
Greetings
---------------------------------------
Daniel Walzenbach
MCP

www.walzenbach.net

"Chris Kennedy" <ck************ **@bleyonder.co .uk> schrieb im Newsbeitrag
news:O2******** ******@TK2MSFTN GP12.phx.gbl...
I want to press a button and have it change an XML file. Those changes need
to be place before the page loads again, specifically at the page
initialisation stage. I am using the XML file to determine which controls
to
add to the page. It's really long winded to explain why I need this but
this is the order I need things executed:

Load Page with button.
Press button, amend XML file.
Postback and use changed XML file in the load event.

My understanding is the postback processing takes place AFTER the load
which
is too late.

If I repost the XML will have changed and the user won't notice. Currently
I
have to press the button twice for the changes in XML to show up.
If you need more info that's fine but I don't want to make things so
longwinded to put people off! Regards, Chris.
"Daniel Walzenbach" <da************ ***@newsgroup.n ospam> wrote in message
news:#j******** ******@TK2MSFTN GP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

---------------------------------------
Daniel Walzenbach
MCP

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPA M.com> schrieb im Newsbeitrag
news:Ot******** ******@TK2MSFTN GP12.phx.gbl...
> There is no sense in triggering postback twice. Could you specify more
> details of what you're after?
>
> --
> Victor Garcia Aprea
> Microsoft MVP | ASP.NET
> Read my weblog:
> Followers of the IHttpHandler
> http://clariusconsulting.net/vga
>
>
> "Chris Kennedy" <ck************ **@bleyonder.co .uk> wrote in message
> news:uv******** ******@TK2MSFTN GP14.phx.gbl...
>>I want to click a button and have it does something before the page
>>reloads.
>> I now realize the page processes the server side event after page loads. >> Is
>> there any way of triggering the postback twice. I know its a hack.....
>>
>>
>>
>>
>
>



Nov 19 '05 #9

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

Similar topics

5
2047
by: Matthew Louden | last post by:
I created simple ASP.NET web application to test how AutoPostBack property in a web control works. I set AutoPostBack property to be true of a web control. When I run the application, here's the sequences when I step through the program: 1. Page loaded to the browser 2. Page_Load method is called with non-postback event 3. The user has certain actions on a control 4. Page_Load method is called with postback event
2
4359
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
8
11166
by: walesboy | last post by:
greetings - I have a btnSubmit button with a Handles btnSubmit.click which works great if all the user does is click that button. But, if the user ALSO changes a text box on the page (which has it's own event and autopostback=true) before clicking submit then it fires the text box event but never fires the btnSubmit event. (I follow it in the trace). Surely both event handlers should be fired? Any hints on identifying what I
4
3424
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void RaiseCallbackEvent(string eventArgs) { // update the data object with the values currently on screen FormView1.UpdateItem(true); }
1
17048
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater control in my aspx page with two image buttons, one for an edit command, another a delete command. Here is a cut down code fragment. ...
2
620
by: Wizzard | last post by:
I have a repeater with and imagebutton on a page useing VS2005 ASP.Net 2.0 <asp:Repeater ID="Repeater1" runat="server" > <ItemTemplate> <div> <asp:ImageButton ImageUrl="button.gif" ID="ImageButton1" runat="server" /> <p><%# Eval("Name") %></p> </div> </ItemTemplate>
11
14830
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be processed by the web server. I am still struggling to understand this postback logic, and hope that some kind gurus out there could help me clarify the confusion I have.
7
3363
by: Tony Girgenti | last post by:
Hello. I'm trying to undetrstand ASP.NET 2.0 and javascript. When i have a button and i click on it and i see the web broswer progress bar at the bottom do something, does that mean that there is postback occurring? Does that mean a round trip to the server occurred? I keep reading javascript articles and tutorials that say "improve the client-side experience to be more responsive and quicker", but the articles
2
3929
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever possible to make the app more efficient and less resource demanding. On one page there are 2...
0
9646
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, 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...
0
9484
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10350
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6742
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();...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
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
3
2887
bsmnconsultancy
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...

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.