-1

下面的代码似乎很长,但不难理解我在那段代码中做了什么。希望你能给我一个解决方案。

我有一个ID="ASPxPanel2"stype 设置为display:none.

单击按钮后New->将显示面板。

当我将ASPxPanel2display:block 设置为默认值时,Panel1将显示在Panel2. 但是当我设置 Panel2 display:none 然后display:block在后面的代码中再次设置它---> Panel2display cover Panel1

    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

    <table>
    <tr>
    <td>
    <dx:ASPxPanel ID="ASPxPanel2" runat="server" Width="700px" Height="150px"  RenderMode="Table"  CssClass="display_none">//set to display:none here
    <PanelCollection>
    <dx:PanelContent ID="PanelContent1" runat="server" SupportsDisabledAttribute="True">
    <table>
    <tr>
    <td colspan=4>
        <asp:Label ID="LabelError" runat="server" ForeColor="red" Text="">
         </asp:Label>
    </td
    </tr>
    <tr>
    <td>Đối tượng</td>
    <td>
        <dx:ASPxComboBox ID="MA_DOI_TUONG" runat="server" ClientIDMode="AutoID" 
            ValueType="System.String">
        </dx:ASPxComboBox>
    </td>
    <td>Loại</td>
    <td >
           <dx:ASPxComboBox ID="MA_LOAI" runat="server" ClientIDMode="AutoID" 
            ValueType="System.String">
        </dx:ASPxComboBox> 
    </td>
    <td class="style6">
    &nbsp;</td>
    <td rowspan=5>
        MoreFileUpload
                        <div style="display: "";" id="div0">
                        <dx:ASPxTextBox ID="TFileUpload0" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload0" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div1">
                        <dx:ASPxTextBox ID="TFileUpload1" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>                    
                        <asp:FileUpload ID="FileUpload1" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div2">
                        <dx:ASPxTextBox ID="TFileUpload2" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload2" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>   

                         <div style="display: none;" id="div3">
                        <dx:ASPxTextBox ID="TFileUpload3" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>                    
                        <asp:FileUpload ID="FileUpload3" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div4">
                        <dx:ASPxTextBox ID="TFileUpload4" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload4" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>
                        <div style="display: none;" id="div5">
                        <dx:ASPxTextBox ID="TFileUpload5" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>                    
                        <asp:FileUpload ID="FileUpload5" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div6">
                        <dx:ASPxTextBox ID="TFileUpload6" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload6" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>
                        <div style="display: none;" id="div7">
                        <dx:ASPxTextBox ID="TFileUpload7" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>                    
                        <asp:FileUpload ID="FileUpload7" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div8">
                        <dx:ASPxTextBox ID="TFileUpload8" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload8" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>
                        <div style="display: none;" id="div9">
                        <dx:ASPxTextBox ID="TFileUpload9" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>                    
                        <asp:FileUpload ID="FileUpload9" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div10">
                        <dx:ASPxTextBox ID="TFileUpload10" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload10" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>
                        <div style="display: none;" id="div11">
                        <dx:ASPxTextBox ID="TFileUpload11" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>                    
                        <asp:FileUpload ID="FileUpload11" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div12">
                        <dx:ASPxTextBox ID="TFileUpload12" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload12" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>
                        <div style="display: none;" id="div13">
                        <dx:ASPxTextBox ID="TFileUpload13" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>                    
                        <asp:FileUpload ID="FileUpload13" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div14">
                        <dx:ASPxTextBox ID="TFileUpload14" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload14" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>
                        <div style="display: none;" id="div15">
                        <dx:ASPxTextBox ID="TFileUpload15" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>                    
                        <asp:FileUpload ID="FileUpload15" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div16">
                        <dx:ASPxTextBox ID="TFileUpload16" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload16" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>
                        <div style="display: none;" id="div17">
                        <dx:ASPxTextBox ID="TFileUpload17" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>                    
                        <asp:FileUpload ID="FileUpload17" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>

                        <div style="display: none;" id="div18">
                        <dx:ASPxTextBox ID="TFileUpload18" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload18" runat="server" accept="png|jpg" Width="180px" size=32 />
                        </div>
                        <div style="display: none;" id="div19">
                        <dx:ASPxTextBox ID="TFileUpload19" runat="server" ClientIDMode="AutoID" 
                                Width="180px" Height="16px">
                        </dx:ASPxTextBox>
                        <asp:FileUpload ID="FileUpload19" runat="server" accept="png|jpg" Width="180px" size=27 />
                        </div>
                        <div style="text-align: left; width: 263px;" id="divShow">
                            <a id="linkMore" href="javascript:void(0)" onclick="javascript:ShowHideFileUpload(this.id)">
                                + Add More ...</a></div>

                        <br /><br />
    </td>
    </tr>
    <tr>
    <td>Title</td>
    <td class="style5" colspan=3>
        <dx:ASPxTextBox ID="TITLE" runat="server" ClientIDMode="AutoID" 
            Width="300px" Height="16px" >
        </dx:ASPxTextBox>
    </td>
    </tr>
    <tr><td>Content</td>
    <td class="style2" colspan=3>
           <FTB:FreeTextBox id="ftCONTENT" runat="server"
           ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,FontForeColorPicker,FontBackColorsMenu,FontBackColorPicker|Bold,Italic,Underline,JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,
           Cut,Copy,Paste,Delete;Undo,Redo,InsertTable,EditTable;InsertTableRowAfter,InsertTableRowBefore,DeleteTableRow;InsertTableColumnAfter,InsertTableColumnBefore,DeleteTableColumn" 
                EditorBorderColorDark="DarkGray" EditorBorderColorLight="DarkGray" 
                Width="100%" GutterBorderColorDark="Gray" GutterBorderColorLight="White" 
                ToolbarStyleConfiguration="Office2000" AutoGenerateToolbarsFromString="True" JavaScriptLocation="InternalResource" />
    </td>
    </tr>
    <tr>
    <td>FileAttach</td>
    <td colspan=3>
            <asp:FileUpload ID="PATH" runat="server" 
                size=40 Width="300px"/></td></tr>
    <tr align=center>
    <td colspan=5 align=center>
            <dx:ASPxButton ID="ASPxButton1" runat="server" ClientIDMode="AutoID" 
                style="text-align: center" Text="Thêm" HorizontalAlign="Center" 
                OnClick="btnInsert_Click">
            </dx:ASPxButton>
    </td>
    </tr>
    </table>
    </dx:PanelContent>
    </PanelCollection>
    </dx:ASPxPanel> 
       </td></tr>
    </dx:ASPxPanel>
    </td>
    </tr>
    </table>  
    </asp:Panel>  //end ASPXPanel2 

    <table>
           <tr>
          <td>
<dx:ASPxPanel ID="ASPxPanel1" runat="server" Width="200px" RenderMode="Table">

        </dx:ASPxPanel>
       </td>
               <td>
                    <asp:Button ID="btnNew" runat="server" Text="NEW" OnClick="btnNew_Click" />
                </td>
            </tr>
        </table> 
</asp:content>   

在后面的代码中:

 protected void btnNew_Click(object sender, EventArgs e)
    {

        ASPxPanel2.Attributes.Add("Style", "display:block");
//do something more

    }

帮助!!!

4

1 回答 1

0

你有损坏的标签。这部分:

 </dx:aspxpanel>
            </td>
        </tr>
        </dx:ASPxPanel>
</td>
</tr>
    </table>
    </asp:Panel>  //end ASPXPanel2 

应该:

                </dx:aspxpanel>
            </td>
        </tr>
    </table>
于 2013-10-07T21:51:27.217 回答