views:

101

answers:

0

hi my dear friends :

why the below alert always shows me null?

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Keyup._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>

<%--    <script src="JQuery/jquery-1.4.1.js" type="text/javascript"></script>--%>
            <script type="text/javascript">

                document.onkeyup = onkeyupOfDocument;

                function onkeyupOfDocument(evt) {
                    //var MultiView = $("*[id$='TextBox1']"); 
                    var MultiView = document.getElementById("MultiView1");
                    alert(MultiView);
                }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
            <asp:View ID="View1" runat="server">
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            </asp:View>
            <asp:View ID="View2" runat="server">
            </asp:View>
        </asp:MultiView>
    </div>
    </form>
</body>
</html>

after solving null problem how can i check ActiveViewIndex With JavaScript or jquey?

it seems

if(MultiView.ActiveViewIndex == 0)

Is Not True!!

thanks in future advance.