How to check if web page loaded

I have a page that has a iframe and a link button on it. When I click the link button I change the src of the iframe to  lets say "". Once test.login is loaded I want to enter a username and password using findcontrol.  My problem is I don't when the page has completed loading. How do I do this with an Iframe. I am not using the webbrowser control because I am not using windows forms. This is a web app.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Once test.login is loaded I want to enter a username and password using findcontrol
Note that test.login is loaded on CLIENT while findcontrol is a SERVER function. You can use javascript on client
<script type="text/javascript">
document.getElementById('ifrm').onload = function() {
    // put your awesome code here
    // to call server function use web methods with HTTPRequest/Ajax

Open in new window

whiwexAuthor Commented:
Yes I don't know javascript very well so I want to do it using my server. I thought findcontrol would work but is doesn't.
Since IFrame source doesn't exists on your server - you can not use findcontrol for IFrame
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

whiwexAuthor Commented:
what if I use runat='server'
Is there anyway to use the webbrowser control in a .net app. I can do what I want using a windows form and the webbrowser control. But not in my web form
Code behind (on your aspPage.vb):
Imports System.Web.Services
Public Class YourPageName
    Inherits System.Web.UI.Page
    Private Class UserInfo
        Public Login As String
        Public Password As String
    End Class

    Public Shared Function GetUser() As UserInfo
        Dim ui As New UserInfo With {.Login = "MyLogin", .Password = "TopSecret"} 
        Return ui
    End Function
End Class

Open in new window

<html xmlns="">
<head runat="server">
    <script type="text/javascript" src=""></script>
    <script type="text/javascript">
           if($('#YourIFrameID').attr('src').indexOf('')==-1) return;
           var params = {};
        type: "POST",
        url: location.pathName+"/GetUser",
        data: params,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {  
             var ui = data.d ? data.d : data;
        fail: function () { alert('Error'); }

    <form id="form1" runat="server">

Open in new window

whiwexAuthor Commented:
I added this but I doesn't work. I am using a master page. I'm not sure how to trigger the login and password.
At any page add public shared function with WebMethod attribute (server side), which return Login/Password
Public Shared Function GetUser() As UserInfo

Open in new window

Then in client part (HTML) add javascript, calling above method (see my previous post). Url parameter should be in form:
url: 'pagePath.aspx/functionName', for example:
url: 'myPageWhereWebMethodIs.aspx/GetUser'

Open in new window

whiwexAuthor Commented:
I never fixed this

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
whiwexAuthor Commented:
I never fixed this
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.