-1

以下のコードはとても長いように見えますが、そのコードで何をしたかを理解するのは難しくありません。解決策を教えてください。

ID="ASPxPanel2"stype が に設定されたパネルがありdisplay:noneます。

ボタンをクリックするとNew--> パネルが表示されます。

ASPxPanel2display:block をデフォルトとして設定すると、 の下Panel1に表示されますPanel2。しかし、 Panel2 display:none を設定してからdisplay:block、コードビハインド--->Panel2ディスプレイカバーで再度設定すると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 に答える