问题描述
嗨......
我对asp.net mvc很感兴趣。我的mvc应用程序有3个Tables.if下拉选择值为1然后tblsolid将是可见的& tblgas将隐藏&如果选择的值为2则tblgas将显示&tblsolid将隐藏。 tblsolid有3行&tblGas13行。如果tblgas将显示然后没有问题。tblcomm显示在tblgas正下方。但是如果每次tblsolid将显示那么tblsolid和tblcomm之间有空格,因为tblsolid包含的行数少于tblgas..这个问题的解决方案是什么?下面是我的三个表结构。
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.
<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>
推荐答案
"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>
这篇关于根据下拉选择值管理表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!