注册 登录
编程论坛 ASP.NET技术论坛

一段代码~~

ibiws 发布于 2007-12-11 18:12, 589 次点击
我在网上看到一段代码,是关于listbox双击事件的,我拷下来调试是好使的,但是我不能把它移植到我的程序中。我的页面中没有明确写<form ~~~>,我用了模板页。所以我的代码中没有form,那么该代码中的<form id="WebForm4" method="post" runat="server">是不是应该该为我的模板页中的代码?花了一下午还没有成功,真的不懂!代码是vbscript写的,我不理解该代码的原理是什么。大家能帮我解读下么?谢谢~
<HTML>
    <HEAD>

    </HEAD>
    <body>
        <form id="WebForm4" method="post" runat="server">
            在服务器端响应双击事件<br>
            <asp:ListBox id="ListBox1" runat="server" Height="169px" Width="97px" DataSourceID="SqlDataSource1" DataTextField="cityName" DataValueField="cityID">

            </asp:ListBox>
            &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
            <asp:ListBox ID="ListBox2" runat="server" Height="166px" Width="95px"></asp:ListBox>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:dropdownTestConnectionString %>"
                SelectCommand="SELECT [cityID], [cityName] FROM [city]"></asp:SqlDataSource>
            <br>
            <asp:Label id="Label1" runat="server"></asp:Label><br>
            <input type="hidden" name="Isdbclick" value="false">
        </form>
        <script language="vbscript">

            option explicit
            sub ListBox1_ondblclick()
                WebForm4.Isdbclick.value="true"
                WebForm4.submit()
            end sub
        </script>
    </body>
</HTML>

帮我看看这个代码执行的原理是什么,我的使用模板页的情况怎样才能使用这段代码?~~谢谢~~
0 回复
1