AjaxControlToolkit ModelPopupExtender显示屏幕的左侧而不是中心

时间:2013-05-09 16:44:50

标签: c# html asp.net css

这是我的ModelPopupExtender代码:

<asp:View ID="ViewCDB" runat="server">
                    <div id="cdbupbar" style="padding:2px">
                        <asp:Button ID="btnCDB" runat="server" CssClass="CButton" 
                            onclick="btnCDB_Click" Text="Create New Discussion Board" />
                        <asp:Panel ID="Panel13" runat="server">
                        <asp:Button ID="Button9" runat="server" Text="Cancel" CssClass="newButton" />
                            <uc2:CreateNewCDB ID="CreateNewCDB1" runat="server" />
                        </asp:Panel>

                        <asp:modalpopupextender id="ModalPopupExtender1" runat="server" 
    targetcontrolid="btnCDB" popupcontrolid="Panel13" CancelControlID="Button9" 
    backgroundcssclass="ModalPopupBG">
</asp:modalpopupextender>
                    </div>
                  </asp:View>

问题是,每当我点击btnCDB按钮时,它会显示模型弹出窗口,但它显示在窗口的左侧而不是中间。我尝试在<div><td>中添加它,并将其对齐属性分配给“中间”,但没有奏效。持有此代码的容器设置为左对齐。我无法更改它,因为它的网站的主要容器,更改其对齐将导致所有网站内容中间。我不想要。我还检查了所有CSS,它们没有影响对齐属性。

1 个答案:

答案 0 :(得分:2)

<asp:Panel ID="Panel13" runat="server" style="margin-left:35%;">

试试这个,如果它有任何区别,你最好为你的面板定义一个css类。