Click here to Skip to main content
15,920,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...

I am begginer to asp.net mvc. My mvc application have 3 Tables.if dropdown selected value is 1 then "tblsolid" will be visible & "tblgas" will be hide & If selected value is 2 then "tblgas will be show & "tblsolid" will be hide." tblsolid" have 3 rows &"tblGas" 13 rows.In case of when "tblgas" will show then there is no problem."tblcomm" is show immediately below "tblgas".BUT in case of whenever "tblsolid" will show then there is space between "tblsolid" & "tblcomm" because "tblsolid" contain minimum rows than "tblgas"..What is solution to this problem ??? Below are the my three table structure.

HTML
<table style="removed: absolute" id="tblSolid">
                           <tr>
                               <td>
                                   Carbon
                               </td>
                               <td>
                                   @Html.TextBox("TbC", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbC)
                               </td>
                           </tr>
                           <tr>
                               <td>
                                   Hydrogen:
                               </td>
                               <td>
                                   @Html.TextBox("TbH", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbH)
                               </td>
                           </tr>
                           <tr>
                               <td>
                                   Nitrogen :
                               </td>
                               <td>
                                   @Html.TextBox("TbN", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbN)
                               </td>
                           </tr>

                       </table>


                       <table id="tblGas">
                           <tr>
                               <td>
                                   CH4
                               </td>
                               <td>
                                   @Html.TextBox("TbCH4", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbCH4)
                               </td>
                           </tr>

                           <tr>
                               <td>
                                   C2H4:
                               </td>
                               <td>
                                   @Html.TextBox("TbC2H4", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbC2H4)
                               </td>
                           </tr>

                           <tr>
                               <td>
                                   C2H6 :
                               </td>
                               <td>
                                   @Html.TextBox("TbC2H6", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbC2H6)
                               </td>
                           </tr>


                           <tr>
                               <td>
                                   C3H6 :
                               </td>
                               <td>
                                   @Html.TextBox("TbC3H6", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbC3H6)
                               </td>
                           </tr>
                           <tr>
                               <td>
                                   C3H8 :
                               </td>
                               <td>
                                   @Html.TextBox("TbC3H8", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbC3H8)
                               </td>
                           </tr>


                           <tr>
                               <td>
                                   C4H10 :
                               </td>
                               <td>
                                   @Html.TextBox("TbC4H10", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbC4H10)
                               </td>
                           </tr>

                           <tr>
                               <td>
                                   C5H12 :
                               </td>
                               <td>
                                   @Html.TextBox("TbC5H12", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbC5H12)
                               </td>
                           </tr>


                           <tr>
                               <td>
                                   C6H6:
                               </td>
                               <td>
                                   @Html.TextBox("TbC6H6", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbC6H6)
                               </td>
                           </tr>


                           <tr>
                               <td>
                                   H2
                               </td>
                               <td>
                                   @Html.TextBox("TbH2", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbH2)
                               </td>
                           </tr>

                           <tr>
                               <td>
                                   CO:
                               </td>
                               <td>
                                   @Html.TextBox("TbCO", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbCO)
                               </td>
                           </tr>

                           <tr>
                               <td>
                                   H2S :
                               </td>
                               <td>
                                   @Html.TextBox("TbH2S", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbH2S)
                               </td>
                           </tr>

                           <tr>
                               <td>
                                   H2OGAS :
                               </td>
                               <td>
                                   @Html.TextBox("TbH2OGAS", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbH2OGAS)
                               </td>
                           </tr>

                           <tr>
                               <td>
                                   SO2:
                               </td>
                               <td>
                                   @Html.TextBox("TbSO2", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbSO2)
                               </td>


                       </tr></table>

                       <table id="tblComm">
                           <tr>
                               <td>
                                   Excess Air:
                               </td>
                               <td>
                                   @Html.TextBox("TbExcessAir", 0, new { style = "width:50px" })
                                   @Html.ValidationMessageFor(m => m.TbExcessAir)
                               </td>
                           </tr>
                       </table>
Posted
Updated 22-Dec-13 12:59pm
v2

Put your break tags or whatever inside the if blocks, so that each element renders itself AND the gap under it.
 
Share this answer
 
Hi Rohini..
Visible=false in aspx page will take care of the space requirements. The server will send only the controls which has visibile=false.

But if you are using a pure HTML page, hiding will hide the control but eat up the space. The best css that you can use is

"display:none"


this would not display the element and wont eat up your space.

you can work on the following if you have any queries.

http://www.w3schools.com/cssref/playit.asp?filename=playcss_display&preval=none[^]


you have to use like
<table style="display:none">
....
</table>
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900