c# - Display:block doesn't work -


i'm tired because problem long day. code below seems long, it's not hard understand did in code. hope can give me solution.

i have panel id="aspxpanel2" stype set display:none.

after click on button new --> panel displayed.

<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 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>  

in code behind:

 protected void btnnew_click(object sender, eventargs e)     {          aspxpanel2.attributes.add("sytle", "display:block"); //do more      } 

i've added aspxpanel2.attributes.add("sytle", "display:block"); when btnnew_click fired, aspxpanel2 isn't displayed.

does display:block not work?? help!!!

update:

i've found mistake, typo: "style" not "sytle"

but has new problem.

there still have aspxpanel1 in webpage. when set aspxpanel2 display:block default, panel1 displays below panel2. when set panel2 display:none , set display:block again in code behind---> panel2 display cover panel1.

help!!!

i've updated code above. please take look!

typo

aspxpanel2.attributes.add("sytle", "display:block"); 

should read

aspxpanel2.attributes.add("style", "display:block"); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -