如何使用jquery在弹出窗口中打开用户控件页面

时间:2014-07-17 09:38:07

标签: jquery asp.net

我想在弹出窗口中打开用户控制页面。在页面加载期间显示弹出窗口。

下面是我的代码。

<script type="text/javascript">
$(function () {
    $("#dialog").dialog({
        title: "jQuery Dialog Popup",
        buttons: {
            Close: function () {
                $(this).dialog('close');
            }
        }
    });
});

下面是用户控制页面代码:

<div id="dialog" style="display: none;position:fixed; margin: 0 0 0 570px;width:50%; height:10%;">         
    <uc3:ucPageUsage ID="ucPageUSage1" runat="server"/> 
</div>


<script language="javascript" type="text/javascript">
function ShowComment(val) {

    document.getElementById('ucPageUSage1_hdn_rdo').value = val.value;

    document.getElementById('ucPageUSage1_btn').click();


}
function HidePage() {
    document.getElementById('ucPageUSage1_div_page').style.display = 'none';
}
</script>
<div id="div_page" runat="server" style="border-bottom-style:ridge; background-    color:White;" visible="true">
<table id="PUTable" align="center" runat="server"  width="100%" cellpadding="4"  cellspacing="4" border="0">
<tr>
<td class="style1" valign="top">
<div id="divrate" runat="server">
<b>Did this Page help you?</b>
<asp:RadioButtonList ID="rdoRate" CssClass="PUText" runat="server" RepeatDirection ="Vertical" >
<asp:ListItem Value="1" onClick="javascript:ShowComment(this); ">Yes</asp:ListItem>
<asp:ListItem Value="2" onClick="javascript:ShowComment(this); ">No</asp:ListItem>
<asp:ListItem Value="3" onClick="javascript:ShowComment(this); ">Not very  useful</asp:ListItem>
</asp:RadioButtonList>

<asp:Button ID="btn" runat="server" CssClass="hiddenbutton" OnClick="btn_Click" UseSubmitBehavior="false" />
</div>
<asp:Label ID="lblInfo" runat="server" Visible="false" ForeColor="Red"></asp:Label>

<div id="divcom" runat="server" visible="false">

<asp:TextBox ID="txtComment" CssClass="PUText" ForeColor="Black" runat="server" TextMode="MultiLine" 
    Width="256px" Height="35px"></asp:TextBox>

<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" UseSubmitBehavior="false" />
<br />
</div>        
</td>
</tr>
</table>
<asp:HiddenField ID="hdn_rdo" runat="server" />
</div>

当我运行此页面时,用户控制页面分别显示而不是显示在弹出窗口内。

我想在弹出窗口中显示usercontrol页面。

1 个答案:

答案 0 :(得分:0)

css样式正在将内容移出Popup窗口,我建议删除css样式并尝试,如下所示。

<div id="dialog">         
    <uc3:ucPageUsage ID="ucPageUSage1" runat="server"/> 
</div>