As you indicated, the contents of the form are displayed on the server upon request, and not on the page load. However, try this code to access the controls on the form. Change the name "FormView" to your unique control identifier.
document.getElementById('<%=FormView.FindControl("txtTitle").ClientID%>');
If necessary, here are a few useful events that you can use to register javascript in the code behind if there are lifecycle considerations.
The ItemCreated event is raised after all rows in the FormView control are created. This can happen when the control is first displayed, or when the user goes to another record. You can use this event to provide an event-handling method that performs a custom procedure, such as adding or changing the contents of a string when this event occurs.
Note: The ItemCreated event occurs before the FormView control is bound to data. To change the value of the associated field, use the DataBound event.
source share