日期:2014-05-17  浏览次数:20448 次

如何给OpenModalDialog附值
我的页面有两个DropDownList,我想在页面跳转的时候将值附加到strYear后面? OnClientClick="return OpenModalDialog('LinePnAdd.aspx?strYear=
请高手赐教。。。谢谢

------解决方案--------------------
document.getElementById('<%= DropDownList.ClientID %>').value
------解决方案--------------------
HTML code
<head runat="server">
    <title></title>

    <script type="text/javascript">
        function openDialog() {
            var city = document.getElementById('<%=ddlCityList.ClientID %>');
            var selectedCity = city.options[city.selectedIndex].value;
            var url = 'LinePnAdd.aspx?strYear=' + selectedCity;
            OpenModalDialog('LinePnAdd.aspx?strYear=' + url);
            return false;
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="ddlCityList" runat="server">
            <asp:ListItem Text="上海" Value="1"></asp:ListItem>
            <asp:ListItem Text="长沙" Value="2"></asp:ListItem>
            <asp:ListItem Text="北京" Value="3"></asp:ListItem>
        </asp:DropDownList>
        <asp:LinkButton ID="lnkbtn" OnClientClick="return openDialog();" runat="server">测试</asp:LinkButton>
    </div>
    </form>
</body>
</html>