i have a question ( i am learning VB) is there is a way in vb.net to make the Me.LoadComplete loads after the client side , i develop this simple code to make it easy to understand my question
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.LoadComplete
MsgBox(myhiddenField.Value)
End Sub
Client
</script>
<title></title>
<script type="text/javascript">
$(document).ready(function() {
$("#<%=myhiddenField.ClientID%>").val('this is the value ') ;
});
</script>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="myLink" runat="server"
PostBackUrl="~/Default.aspx?value=1" >
MyLink </asp:LinkButton>
<asp:HiddenField ID="myhiddenField" runat="server"/>
</div>
</form>
when the page loads , the MsgBox will be empty but when you click the link button the MsgBox has the value you set in the javascript , so i assume that the page_load function gets excuted first
the question is how can i load the client content before the page_load ?
The ASP.NET Lifecycle says no because content isn’t pushed to the browser until Page_Render, which happens after Page_Load.
You could try doing a bunch of work in Page_Init, and use Response.Flush() to force the server to send content to the browser, but
Even if it is possible in any way, shape, or form (which I doubt) – It would be an interesting experiment, but I wouldn’t recommend designing a live app around the idea. The Page Lifecycle is something every ASP.NET developer is (or should be) familiar with, and doing goofy things like that just make it harder for maintenance programmers.