I am having trouble with some javascript that I have added to the codebehind. The goal I am trying to achieve here is on the page load to do another postback. Now, you may find this odd, but there is method to my madness.
In my ASP.Net Wizard, I have a textbox that contains a date populated from another step. This date is then used to populate 3 other controls with financial information. It is necessary for these 3 other controls to be populated on the load of this step. Now I have tried to do simply on page_load, but this doesn't work as certain controls either don't exist or the date isn't in the textbox. I have also tried to do this on the page render method, but this didn't work either for the same reasons.
So, I have resorted to using javascript executing a double postback, but it is causing all sorts of problems.
Here is the code from the Page_Load :
Dim validateFinancial as String = "<script language='javascript'>window.onload = function() ( ValidateFinancialDate() { __doPostBack('<%= UpdatePanel2.ClientID %>'); return false; })</script>"
Page.ClientScript.RegisterStartUp(Me.GetType(), "MyScript", validateFinancial, false)
It is not firing and in the javascript error box you see in the bottom left hand corner of the browser it says missing ";". If I remove the javascript code and simply added it to the markup with the function name in the string it will work with errors, but this when posting to the webserver causes the AJAX controls to fail on the whole page.
Is there away of getting this to work, please?