473,325 Members | 2,828 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,325 software developers and data experts.

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 1427
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**************@TK2MSFTNGP14.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**************@TK2MSFTNGP14.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*@NOobiesSPAM.com> schrieb im Newsbeitrag
news:Ot**************@TK2MSFTNGP12.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**************@TK2MSFTNGP14.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.nospam> wrote in message
news:#j**************@TK2MSFTNGP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

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

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPAM.com> schrieb im Newsbeitrag
news:Ot**************@TK2MSFTNGP12.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**************@TK2MSFTNGP14.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**************@TK2MSFTNGP12.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.nospam> wrote in message
news:#j**************@TK2MSFTNGP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

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

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPAM.com> schrieb im Newsbeitrag
news:Ot**************@TK2MSFTNGP12.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**************@TK2MSFTNGP14.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.HtmlControls.HtmlGenericControl
(Remember to put runat="server" in your body tag.)

Put this code in your buttons click event.
myBody.Attributes.Item("onLoad") = "document.forms[0].submit()"

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

Hope this helps,
Shawn
"Chris Kennedy" <ck**************@bleyonder.co.uk> wrote in message
news:O2**************@TK2MSFTNGP12.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.nospam> wrote in message
news:#j**************@TK2MSFTNGP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

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

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPAM.com> schrieb im Newsbeitrag
news:Ot**************@TK2MSFTNGP12.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**************@TK2MSFTNGP14.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**************@TK2MSFTNGP12.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.nospam> wrote in message
news:#j**************@TK2MSFTNGP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

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

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPAM.com> schrieb im Newsbeitrag
news:Ot**************@TK2MSFTNGP12.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**************@TK2MSFTNGP14.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**************@TK2MSFTNGP12.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.nospam> wrote in message
news:#j**************@TK2MSFTNGP12.phx.gbl...
I agree to Victor. Triggering postback twice is definitely no solution!

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

www.walzenbach.net

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPAM.com> schrieb im Newsbeitrag
news:Ot**************@TK2MSFTNGP12.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**************@TK2MSFTNGP14.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
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...
2
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...
8
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...
4
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...
1
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...
2
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"...
11
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...
7
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...
2
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.