不好意思,之前问过了,还有一些地方不清楚,所以就再发了一次。我的页面中有3个web窗体panel控件,然后我在这些panel上放了一层HTML里的Grid layout panel控件,再在上面放一些textbox之类的控件。我想在把最上面的panel隐藏以后,下面两个panel能够自动移上来,方便浏览。
今天大家告诉我把panel的style属性去掉就可以了,我看了下,web的panel没有style属性,HTML的Grid layout panel倒是有style属性,里面是类似WIDTH: 812px; POSITION: relative; HEIGHT: 272px的内容,我去掉以后仍然不能上移,所以我想问一下是不是哪里做错了,望大家指教,谢谢

解决方案 »

  1.   

    3个panel放在一个单元格里就行,1个隐藏,另2个就上来了。再就是style的left 和 top属性是控制控件在页面的位置的。
      

  2.   

    你的页面代码放上来。首先,panel隐藏后是不会再占位置的。我猜测,你的定位是不是用绝对位置的方式,所以其它两个panel的位置是固定的。
      

  3.   

    页面脚本<%@ Register TagPrefix="uc1" TagName="DRPNavigator" Src="../UserControl/DRPNavigator.ascx" %>
    <%@ Page language="c#" Codebehind="Level.aspx.cs" AutoEventWireup="false" Inherits="DRP.Content.Level" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:panel id="Paneltitle" style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute; TOP: 32px"
    runat="server" Width="808px" Height="40px">
    <DIV style="WIDTH: 811px; POSITION: relative; HEIGHT: 72px" ms_positioning="GridLayout">
    <asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 48px; POSITION: absolute; TOP: 16px" runat="server"
    Width="514px" ForeColor="Red">现在收集信息以确定您系统的恢复等级,请点击右侧的开始答题按钮开始</asp:Label>
    <asp:Button id="BtnAnswer" style="Z-INDEX: 102; LEFT: 592px; POSITION: absolute; TOP: 16px"
    runat="server" Width="96px" Text="开始答题"></asp:Button>
    <asp:Button id="BtnJustShow" style="Z-INDEX: 103; LEFT: 264px; POSITION: absolute; TOP: 48px"
    runat="server" Width="208px" Text="Button"></asp:Button></DIV>
    </asp:panel><asp:panel id="PanelQues" style="Z-INDEX: 102; LEFT: 56px; POSITION: absolute; TOP: 128px"
    runat="server" Width="821px" Height="280px" Visible="False">
    <DIV style="WIDTH: 812px; POSITION: relative; HEIGHT: 272px" ms_positioning="GridLayout">
    <asp:TextBox id="TxtMemo" style="Z-INDEX: 101; LEFT: 280px; POSITION: absolute; TOP: 184px" runat="server"
    Height="34px" Width="361px" TextMode="MultiLine"></asp:TextBox>
    <asp:Button id="BtnNext" style="Z-INDEX: 104; LEFT: 568px; POSITION: absolute; TOP: 240px" runat="server"
    Height="32px" Width="64px" Text="下一步"></asp:Button>
    <asp:Button id="BtnPrev" style="Z-INDEX: 105; LEFT: 464px; POSITION: absolute; TOP: 240px" runat="server"
    Height="32px" Width="64px" Text="上一步"></asp:Button>
    <asp:TextBox id="TxtQues" style="Z-INDEX: 106; LEFT: 16px; POSITION: absolute; TOP: 8px" runat="server"
    Height="48px" Width="624px" TextMode="MultiLine"></asp:TextBox>
    <asp:RadioButtonList id="RadioButtonList1" style="Z-INDEX: 109; LEFT: 32px; POSITION: absolute; TOP: 72px"
    runat="server"></asp:RadioButtonList></DIV>
    </asp:panel><asp:panel id="PanelShowLevel" style="Z-INDEX: 103; LEFT: 56px; POSITION: absolute; TOP: 416px"
    runat="server" Width="816px" Height="184px">
    <DIV style="WIDTH: 812px; POSITION: relative; HEIGHT: 258px" ms_positioning="GridLayout">
    <asp:RadioButton id="RadioButton1" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 88px"
    runat="server" Text="本地0级" GroupName="LL"></asp:RadioButton>
    <asp:RadioButton id="RadioButton2" style="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 120px"
    runat="server" Text="本地1级" GroupName="LL"></asp:RadioButton>
    <asp:RadioButton id="RadioButton3" style="Z-INDEX: 103; LEFT: 128px; POSITION: absolute; TOP: 88px"
    runat="server" Text="本地2级" GroupName="LL"></asp:RadioButton>
    <asp:RadioButton id="RadioButton4" style="Z-INDEX: 105; LEFT: 128px; POSITION: absolute; TOP: 120px"
    runat="server" Text="本地3级" GroupName="LL"></asp:RadioButton>
    <asp:RadioButton id="RadioButton5" style="Z-INDEX: 106; LEFT: 328px; POSITION: absolute; TOP: 88px"
    runat="server" Text="异地0级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton6" style="Z-INDEX: 107; LEFT: 328px; POSITION: absolute; TOP: 120px"
    runat="server" Text="异地1级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton7" style="Z-INDEX: 108; LEFT: 424px; POSITION: absolute; TOP: 88px"
    runat="server" Text="异地2级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton8" style="Z-INDEX: 109; LEFT: 424px; POSITION: absolute; TOP: 120px"
    runat="server" Text="异地3级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton9" style="Z-INDEX: 110; LEFT: 520px; POSITION: absolute; TOP: 88px"
    runat="server" Text="异地4级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton10" style="Z-INDEX: 111; LEFT: 520px; POSITION: absolute; TOP: 120px"
    runat="server" Text="异地5级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton11" style="Z-INDEX: 112; LEFT: 608px; POSITION: absolute; TOP: 88px"
    runat="server" Text="异地6级" GroupName="LR"></asp:RadioButton>
    <asp:Label id="LabelTitle" style="Z-INDEX: 113; LEFT: 288px; POSITION: absolute; TOP: 32px"
    runat="server" Width="193px">该项目本地与异地等级</asp:Label>
    <asp:Label id="LabelLocal" style="Z-INDEX: 114; LEFT: 56px; POSITION: absolute; TOP: 56px"
    runat="server" Width="193px">本地等级</asp:Label>
    <asp:Label id="LabelRemote" style="Z-INDEX: 115; LEFT: 504px; POSITION: absolute; TOP: 56px"
    runat="server" Width="193px">异地等级</asp:Label>
    <asp:Button id="BtnConfirm" style="Z-INDEX: 116; LEFT: 608px; POSITION: absolute; TOP: 176px"
    runat="server" Height="32px" Width="64px" Text="确 定"></asp:Button>
    <asp:Button id="BtnRestart" style="Z-INDEX: 117; LEFT: 504px; POSITION: absolute; TOP: 176px"
    runat="server" Height="32px" Width="64px" Text="重新回答"></asp:Button>
    <asp:LinkButton id="LinkButtonNext" style="Z-INDEX: 104; LEFT: 568px; POSITION: absolute; TOP: 232px"
    runat="server">进入下一步(未完成)</asp:LinkButton></DIV>
    </asp:panel><uc1:drpnavigator id="DRPNavigator1" runat="server"></uc1:drpnavigator>
    <asp:Panel id="PnlJustShow" style="Z-INDEX: 104; LEFT: 56px; POSITION: absolute; TOP: 704px"
    runat="server" Height="88px" Width="808px">
    <DIV style="WIDTH: 816px; POSITION: relative; HEIGHT: 340px" ms_positioning="GridLayout">
    <asp:Label id="LabelJustShow" style="Z-INDEX: 101; LEFT: 72px; POSITION: absolute; TOP: 16px"
    runat="server" Width="136px">已回答的问题</asp:Label>
    <asp:TextBox id="TxtJustShow" style="Z-INDEX: 102; LEFT: 64px; POSITION: absolute; TOP: 44px"
    runat="server" Height="270px" Width="656px" TextMode="MultiLine"></asp:TextBox></DIV>
    </asp:Panel></form>
    </body>
    </HTML>
      

  4.   

    不用table的话,说是把style去掉。但是web窗体的panel没有style属性,只有borderstyle,默认是notset,我想应该不是这个吧
      

  5.   

    panel控件没有style这个属性,但不代表你不能使用这个属性,panel在展现到页面的时候,是一个DIV,你用style怎样控制div,就可以怎样控制panel
      

  6.   

    请问,是不是在前台的这么写
    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    this.Panel1.Style.Add("display","none");

    }
    这样的话,Panel1就隐藏掉了,然后下面的那些就提上来了么?
    我测试的话,Panel1是隐藏掉了,但是后面并没有提上呢。
      

  7.   

    在Document属性将设计方式改为流,试一下
      

  8.   

    如果是2005,那么将它放在mulityview中,设置view.visible属性.
      

  9.   

    <%@ Register TagPrefix="uc1" TagName="DRPNavigator" Src="../UserControl/DRPNavigator.ascx" %>
    <%@ Page language="c#" Codebehind="Level.aspx.cs" AutoEventWireup="false" Inherits="DRP.Content.Level" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <asp:panel id="Paneltitle" style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute; TOP: 32px"
    runat="server" Width="808px" Height="40px">
    <DIV style="WIDTH: 811px; POSITION: relative; HEIGHT: 72px" ms_positioning="GridLayout">
    <asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 48px; POSITION: absolute; TOP: 16px" runat="server"
    Width="514px" ForeColor="Red">现在收集信息以确定您系统的恢复等级,请点击右侧的开始答题按钮开始</asp:Label>
    <asp:Button id="BtnAnswer" style="Z-INDEX: 102; LEFT: 592px; POSITION: absolute; TOP: 16px"
    runat="server" Width="96px" Text="开始答题"></asp:Button>
    <asp:Button id="BtnJustShow" style="Z-INDEX: 103; LEFT: 264px; POSITION: absolute; TOP: 48px"
    runat="server" Width="208px" Text="Button"></asp:Button></DIV>
    </asp:panel><asp:panel id="PanelQues" style="Z-INDEX: 102; LEFT: 56px; POSITION: absolute; TOP: 128px"
    runat="server" Width="821px" Height="280px" Visible="False">
    <DIV style="WIDTH: 812px; POSITION: relative; HEIGHT: 272px" ms_positioning="GridLayout">
    <asp:TextBox id="TxtMemo" style="Z-INDEX: 101; LEFT: 280px; POSITION: absolute; TOP: 184px" runat="server"
    Height="34px" Width="361px" TextMode="MultiLine"></asp:TextBox>
    <asp:Button id="BtnNext" style="Z-INDEX: 104; LEFT: 568px; POSITION: absolute; TOP: 240px" runat="server"
    Height="32px" Width="64px" Text="下一步"></asp:Button>
    <asp:Button id="BtnPrev" style="Z-INDEX: 105; LEFT: 464px; POSITION: absolute; TOP: 240px" runat="server"
    Height="32px" Width="64px" Text="上一步"></asp:Button>
    <asp:TextBox id="TxtQues" style="Z-INDEX: 106; LEFT: 16px; POSITION: absolute; TOP: 8px" runat="server"
    Height="48px" Width="624px" TextMode="MultiLine"></asp:TextBox>
    <asp:RadioButtonList id="RadioButtonList1" style="Z-INDEX: 109; LEFT: 32px; POSITION: absolute; TOP: 72px"
    runat="server"></asp:RadioButtonList></DIV>
    </asp:panel><asp:panel id="PanelShowLevel" style="Z-INDEX: 103; LEFT: 56px; POSITION: absolute; "
    runat="server" Width="816px" Height="184px">
    <DIV style="WIDTH: 812px; POSITION: relative; HEIGHT: 258px" ms_positioning="GridLayout">
    <asp:RadioButton id="RadioButton1" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 88px"
    runat="server" Text="本地0级" GroupName="LL"></asp:RadioButton>
    <asp:RadioButton id="RadioButton2" style="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 120px"
    runat="server" Text="本地1级" GroupName="LL"></asp:RadioButton>
    <asp:RadioButton id="RadioButton3" style="Z-INDEX: 103; LEFT: 128px; POSITION: absolute; TOP: 88px"
    runat="server" Text="本地2级" GroupName="LL"></asp:RadioButton>
    <asp:RadioButton id="RadioButton4" style="Z-INDEX: 105; LEFT: 128px; POSITION: absolute; TOP: 120px"
    runat="server" Text="本地3级" GroupName="LL"></asp:RadioButton>
    <asp:RadioButton id="RadioButton5" style="Z-INDEX: 106; LEFT: 328px; POSITION: absolute; TOP: 88px"
    runat="server" Text="异地0级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton6" style="Z-INDEX: 107; LEFT: 328px; POSITION: absolute; TOP: 120px"
    runat="server" Text="异地1级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton7" style="Z-INDEX: 108; LEFT: 424px; POSITION: absolute; TOP: 88px"
    runat="server" Text="异地2级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton8" style="Z-INDEX: 109; LEFT: 424px; POSITION: absolute; TOP: 120px"
    runat="server" Text="异地3级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton9" style="Z-INDEX: 110; LEFT: 520px; POSITION: absolute; TOP: 88px"
    runat="server" Text="异地4级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton10" style="Z-INDEX: 111; LEFT: 520px; POSITION: absolute; TOP: 120px"
    runat="server" Text="异地5级" GroupName="LR"></asp:RadioButton>
    <asp:RadioButton id="RadioButton11" style="Z-INDEX: 112; LEFT: 608px; POSITION: absolute; TOP: 88px"
    runat="server" Text="异地6级" GroupName="LR"></asp:RadioButton>
    <asp:Label id="LabelTitle" style="Z-INDEX: 113; LEFT: 288px; POSITION: absolute; TOP: 32px"
    runat="server" Width="193px">该项目本地与异地等级</asp:Label>
    <asp:Label id="LabelLocal" style="Z-INDEX: 114; LEFT: 56px; POSITION: absolute; TOP: 56px"
    runat="server" Width="193px">本地等级</asp:Label>
    <asp:Label id="LabelRemote" style="Z-INDEX: 115; LEFT: 504px; POSITION: absolute; TOP: 56px"
    runat="server" Width="193px">异地等级</asp:Label>
    <asp:Button id="BtnConfirm" style="Z-INDEX: 116; LEFT: 608px; POSITION: absolute; TOP: 176px"
    runat="server" Height="32px" Width="64px" Text="确 定"></asp:Button>
    <asp:Button id="BtnRestart" style="Z-INDEX: 117; LEFT: 504px; POSITION: absolute; TOP: 176px"
    runat="server" Height="32px" Width="64px" Text="重新回答"></asp:Button>
    <asp:LinkButton id="LinkButtonNext" style="Z-INDEX: 104; LEFT: 568px; POSITION: absolute; TOP: 232px"
    runat="server">进入下一步(未完成)</asp:LinkButton></DIV>
    </asp:panel>
    <asp:Panel id="PnlJustShow" style="Z-INDEX: 104; LEFT: 56px; POSITION: absolute; TOP: 210px"
    runat="server" Height="88px" Width="808px">
    <DIV style="WIDTH: 816px; POSITION: relative; HEIGHT: 340px" ms_positioning="GridLayout">
    <asp:Label id="LabelJustShow" style="Z-INDEX: 101; LEFT: 72px; POSITION: absolute; TOP: 16px"
    runat="server" Width="136px">已回答的问题</asp:Label>
    <asp:TextBox id="TxtJustShow" style="Z-INDEX: 102; LEFT: 64px; POSITION: absolute; TOP: 44px"
    runat="server" Height="270px" Width="656px" TextMode="MultiLine"></asp:TextBox></DIV>
    </asp:Panel></form>
    </body>
    </HTML>试下??