当前位置: 代码迷 >> ASP.NET >> 怎么给OpenModalDialog附值
  详细解决方案

怎么给OpenModalDialog附值

热度:9185   发布时间:2013-02-25 00:00:00.0
如何给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>
  相关解决方案