I agree to Victor. Triggering postback twice is definitely no solution!
---------------------------------------
Daniel Walzenbach
MCP
www.walzenbach.net
> There is no sense in triggering postback twice. Could you specify more
> details of what you're after?
[quoted text clipped - 4 lines]
>> Is
>> there any way of triggering the postback twice. I know its a hack.....
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.
> I agree to Victor. Triggering postback twice is definitely no solution!
>
[quoted text clipped - 19 lines]
> >> Is
> >> there any way of triggering the postback twice. I know its a hack.....
Robbe Morris [C# MVP] - 23 Jul 2005 18:02 GMT
As an example of how you might want to handle the
dynamic loading of your controls:
http://www.eggheadcafe.com/articles/extendtextboxviewstate.asp

Signature
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
>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
[quoted text clipped - 41 lines]
>> >> Is
>> >> there any way of triggering the postback twice. I know its a hack.....
Shawn - 23 Jul 2005 22:00 GMT
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
> 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
[quoted text clipped - 38 lines]
> > >> Is
> > >> there any way of triggering the postback twice. I know its a hack.....
Victor Garcia Aprea [MVP] - 23 Jul 2005 23:35 GMT
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.

Signature
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Read my weblog:
Followers of the IHttpHandler
http://clariusconsulting.net/vga
>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
[quoted text clipped - 41 lines]
>> >> Is
>> >> there any way of triggering the postback twice. I know its a hack.....
Daniel Walzenbach - 24 Jul 2005 04:41 GMT
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
>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
[quoted text clipped - 41 lines]
>> >> Is
>> >> there any way of triggering the postback twice. I know its a hack.....