I'm new to this so sry for asking but i can't find a solution on this, and i dont know how to do it.

I have an IF statsment on code_behind for an asp.net page, like this.:

Code:
    If Session("UserActiv") IsNot Nothing Then
        If Session("UserActiv").ToString() = "N" Then
            ClientScript.RegisterStartupScript(Me.GetType(), "Details", "LoadDetails();", True)
        End If
    Else
        ClientScript.RegisterStartupScript(Me.GetType(), "Details", "LoadDetails();", True)
    End If
if my session isNot nothing, and if its N then it run the function LoadDetails() If nothing then it also load the function, and if Y then do nothing.

then i have the function on my main page, my only problem is, that it load the function every time i load the page, also if the session is Y, i have checked for upper Y/N and lower y/n issues and all is in UPPER case. so no problem there.

my loadDetails() function is like this:

Code:
    <script language="javascript" type="text/javascript">
        function LoadDetails() {
            myModal.load();
        }

        $(document).ready(function () {

            $("#myModal").modal({
                "backdrop": "static",  // if true, then the backdrop can be closed with a click, if false then there is no backdrop.
                "keyboard": false
            })

    });
    </script>
Can someone help me getting this to work, so it load at page_load like now, BUT only if the session is nothing or if its N..
I know its my script thats wrong, but i dont know how to fix it.