asp.net ModalPopupExtender:需要显示时溢出滚动条 [英] asp.net ModalPopupExtender : need to show scroll bar when overflow

查看:269
本文介绍了asp.net ModalPopupExtender:需要显示时溢出滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我显示一个ModalPopupExtender一个gridview。
当屏幕分辨率为小,弹出的是大,全部显示在网页上。

我只是想滚动条添加到弹出时,这种情况发生。

我知道这可能是一些CSS,但我试过没有工作。

下面一些基本的CSS

  .modalTextBoxBackground
{
   背景颜色:灰色;
   过滤器:α(不透明= 70);
   不透明度:0.7;
}
.modalTextBox
{
    边框:1px的固体#FFFFFF;
    背景颜色:#0066CC;
    颜色:#00FFFF;}

在这里从ASPX一些code

 < ASP:面板ID =OptionSelectionPanel=服务器的CssClass =modalTextBox>
            < ASP:的UpdatePanel ID =OptionSelectionUpdatePanel=服务器的UpdateMode =条件>
            <&触发器GT;
                < ASP:asyncPostBackTrigger控件ID =TemplateSelection/>
            < /触发器>
            <&的ContentTemplate GT;            <表类=EditRow>
            &所述; TR类=的HeaderFooter>
            < TD合并单元格=3级=modalTextBoxTitle>
                选项​​添加到报价
            < / TD>
            < / TR>
            &所述; TR>
            &所述; TD>
                生产厂家
            < / TD>
             &所述; TD>
                < ASP:DropDownList的ID =OptionManufacturerFilter=服务器
                    的DataSourceID =OptionManufacturerDataSourceDataTextField =姓名
                    DataValueField =code的AutoPostBack =真>
                < / ASP:DropDownList的>
            < / TD>
            < / TR>                            &所述; TR>
            &所述; TD列跨度=3>
                < ASP:GridView控件ID =NewOptionSelection
                              =服务器
                              的DataSourceID =AvailableOptions
                              的DataKeyNames =Option_Id
                              AllowPaging =真
                              AllowSorting =真
                              的AutoGenerateColumns =假>
                <柱体和GT;
                    < ASP:BoundField的数据字段=category_Descr的HeaderText =类别SORTEX pression =category_Descr,subcategory_Descr,code/>
                    < ASP:BoundField的数据字段=subcategory_Descr的HeaderText =子类别SORTEX pression =subcategory_Descr,code/>
                    < ASP:BoundField的数据字段=Manuf_Name的HeaderText =制造商SORTEX pression =Manuf_Name/>
                < /专栏>< / ASP:GridView的>
            < / TD>
            < / TR>
            &所述; TR类=的HeaderFooter>
            < TD合并单元格=3级=中心>
                < ASP:按钮的ID =OptionSelectionClose=服务器文本=关闭/>            < / TD>
            < / TR>
            < /表>
             < /&的ContentTemplate GT;
            < / ASP:的UpdatePanel>
        < / ASP:面板>
       < ASP:按钮=服务器ID =HiddenTargetControlForOptionSelectionModalPopup的风格=显示:无/>
        < CC1:ModalPopupExtender ID =OptionSelectionModalPopupExtender=服务器
                                的TargetControlID =HiddenTargetControlForOptionSelectionModalPopup
                                PopupControlID =OptionSelectionPanel
                                BackgroundCssClass =modalTextBoxBackground/>


解决方案

我刚刚发现这一点。

ModalPopupExtender不显示滚动条

它仍然没有工作,但就因为我用的是母版,让我解决了这个使用客户端ID

(注:居中内心的 ASP:面板垂直,我发现的唯一的事情是用把它变成一个表格单元格风格= 垂直对齐:中间的
我还需要设置的 OptionSelectionTable 使用JavaScript的高度,因为 HEIGHT =100%失败,一些浏览器。)

 <脚本类型=文/ JavaScript的>
  功能页面加载(){
      $得到('<%= OptionSelectionPanel.ClientID%GT;')。style.height = document.documentElement.clientHeight * 0.9 +PX
      $得到('<%= OptionSelectionTable.ClientID%GT;')。style.height = document.documentElement.clientHeight * 0.9 +PX
  }
    < / SCRIPT>

我也不得不添加 Horizo​​ntalAlign =中心滚动条=自动,并在面板ID =OptionSelectionPanel(该modalpopup的 PopupControlID )。

我感动的的CssClass =modalTextBox来内 ASP:面板并恢复了 Horizo​​ntalAlign =左

 < ASP:面板ID =OptionSelectionPanel=服务器
            Horizo​​ntalAlign =中心滚动条=自动>
            < ASP:的UpdatePanel ID =OptionSelectionUpdatePanel
                             =服务器
                             的UpdateMode =条件>
            <&触发器GT;
                < ASP:asyncPostBackTrigger控件ID =TemplateSelection/>
            < /触发器>
            <&的ContentTemplate GT;
                <表ID =OptionSelectionTable
                       =服务器
                       边界=0
                       CELLPADDING =0
                       CELLSPACING =0>
                        &所述; TR>
                        < TD风格=垂直对齐:中间的>
                                < ASP:面板ID =OptionSelectionInnerPanel
                                           =服务器
                                           Horizo​​ntalAlign =左
                                           的CssClass =modalTextBox>
                                  <表类=EditRow>
                                              ......
                                  < /表>
                               < / ASP:面板>
                  < / TD>< / TR>< /表>
             < /&的ContentTemplate GT;
            < / ASP:的UpdatePanel>
        < / ASP:面板>

I display a gridview in a ModalPopupExtender. When the screen resolution is to small, the pop-up is to big to all be displayed on the page.

I just want to add scroll bar to the pop-up when this happen.

I know it's probably some CSS, but all I tried did not work.

here some base css

.modalTextBoxBackground
{
   background-color:Gray;
   filter:alpha(opacity=70);
   opacity:0.7;
}  
.modalTextBox
{
    border: 1px solid #FFFFFF;
    background-color: #0066CC;
    color: #00FFFF;

}

here some code from the aspx

<asp:Panel ID="OptionSelectionPanel" runat="server" CssClass="modalTextBox">
            <asp:UpdatePanel ID="OptionSelectionUpdatePanel" runat="server" UpdateMode="Conditional" >
            <Triggers>
                <asp:asyncPostBackTrigger ControlID="TemplateSelection" />
            </Triggers>
            <ContentTemplate>

            <table class="EditRow">
            <tr class="HeaderFooter">
            <td colspan="3" class="modalTextBoxTitle">
                Add options to Quote
            </td>
            </tr>
            <tr>
            <td>
                Manufacturer
            </td>
             <td>
                <asp:DropDownList ID="OptionManufacturerFilter" runat="server" 
                    DataSourceID="OptionManufacturerDataSource" DataTextField="Name" 
                    DataValueField="Code" AutoPostBack="True" >
                </asp:DropDownList>
            </td>
            </tr>

                            <tr>
            <td colspan="3">
                <asp:GridView ID="NewOptionSelection" 
                              runat="server" 
                              DataSourceID="AvailableOptions" 
                              DataKeyNames="Option_Id"
                              AllowPaging="True" 
                              AllowSorting="True" 
                              AutoGenerateColumns="false">
                <Columns>
                    <asp:BoundField DataField="category_Descr" HeaderText="Category" SortExpression="category_Descr,subcategory_Descr,code" />
                    <asp:BoundField DataField="subcategory_Descr" HeaderText="Sub-Category" SortExpression="subcategory_Descr,code" />
                    <asp:BoundField DataField="Manuf_Name" HeaderText="Manufacturer" SortExpression="Manuf_Name"/>
                </Columns></asp:GridView>
            </td>
            </tr>
            <tr class="HeaderFooter">
            <td colspan="3" class="Center">
                <asp:Button ID="OptionSelectionClose" runat="server" Text="Close" />

            </td>
            </tr>
            </table>
             </ContentTemplate>
            </asp:UpdatePanel>
        </asp:Panel>
       <asp:Button runat="server" ID="HiddenTargetControlForOptionSelectionModalPopup" style="display:none"/>    
        <cc1:ModalPopupExtender ID="OptionSelectionModalPopupExtender" runat="server" 
                                TargetControlID="HiddenTargetControlForOptionSelectionModalPopup"
                                PopupControlID="OptionSelectionPanel" 
                                BackgroundCssClass="modalTextBoxBackground" />

解决方案

I just found this.

ModalPopupExtender does not show scroll bar

it was still not working, but it was because I use a masterpage, so I solved this using the ClientID.

(note: to center that inner asp:panel vertically, the only thing I found was to put it into a Table cell using style="vertical-align:middle". I also need set OptionSelectionTable's height using JavaScript because height="100%" fail with some browser.)

<script type="text/javascript">
  function pageLoad() {
      $get('<%= OptionSelectionPanel.ClientID %>').style.height = document.documentElement.clientHeight * 0.9 + "px";
      $get('<%= OptionSelectionTable.ClientID %>').style.height = document.documentElement.clientHeight * 0.9 + "px";
  }
    </script> 

I also had to add the HorizontalAlign="Center" and ScrollBars="Auto" and to the Panel ID="OptionSelectionPanel" (the modalpopup's PopupControlID).

I moved the CssClass="modalTextBox" to an inner asp:panel and restored the HorizontalAlign="Left".

 <asp:Panel ID="OptionSelectionPanel" runat="server" 
            HorizontalAlign="Center" ScrollBars="auto">
            <asp:UpdatePanel ID="OptionSelectionUpdatePanel" 
                             runat="server" 
                             UpdateMode="Conditional" >
            <Triggers>
                <asp:asyncPostBackTrigger ControlID="TemplateSelection" />
            </Triggers>
            <ContentTemplate>
                <table ID="OptionSelectionTable" 
                       runat="server" 
                       border="0" 
                       cellpadding="0" 
                       cellspacing="0">
                        <tr>
                        <td style="vertical-align:middle">    
                                <asp:Panel ID="OptionSelectionInnerPanel" 
                                           runat="server" 
                                           HorizontalAlign="Left" 
                                           CssClass="modalTextBox">
                                  <table class="EditRow">


                                              ......


                                  </table>
                               </asp:Panel>
                  </td></tr></table> 
             </ContentTemplate>
            </asp:UpdatePanel>
        </asp:Panel>

这篇关于asp.net ModalPopupExtender:需要显示时溢出滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆