5 셀을 포함하는 각 세트의 첫 번째 행에 2 세트의 셀이있는 테이블이 있습니다. 각 셀에는 내부에 컨트롤이 들어 있습니다.표 셀을 그룹화하여 한 문장으로 숨길 수있는 방법은 무엇입니까? (webforms)
내 조건은 특정 조건이 참이면 조건이 거짓 일 때 한 집합을 숨기고 다른 집합을 표시해야하며 반대의 경우도 마찬가지입니다. 현재 나는 진실한 부분에 대해 내 코드에 10 개의 .Visible = 문을, 거짓 부분에 10 개의 문을 가지고 있습니다. 그룹을 숨기려면 모두 5를 숨길 수 있도록 함께 세포의 집합을 group
방법이 있습니까? 서버 측 코드에서 jQuery를 모두 사용해야합니다.
<table>
<tr>
<!-- first set -->
<td runat="server" id="set1_cell1"> content here</td>
<td runat="server" id="set1_cell2"> content here</td>
<td runat="server" id="set1_cell3"> content here</td>
<td runat="server" id="set1_cell4"> content here</td>
<td runat="server" id="set1_cell5"> content here</td>
<!-- end first set -->
<!-- second set -->
<td runat="server" id="set2_cell1"> content here</td>
<td runat="server" id="set2_cell2"> content here</td>
<td runat="server" id="set2_cell3"> content here</td>
<td runat="server" id="set2_cell4"> content here</td>
<td runat="server" id="set2_cell5"> content here</td>
<!-- end second set -->
</tr>
...
</table>
이 난 그냥 하나 그 10 문을 대체하는 사랑
if (condition is true)
{
set1_cell1.Visible = true;
set1_cell2.Visible = true;
set1_cell3.Visible = true;
set1_cell4.Visible = true;
set1_cell5.Visible = true;
set2_cell1.Visible = false;
set2_cell2.Visible = false;
set2_cell3.Visible = false;
set2_cell4.Visible = false;
set2_cell5.Visible = false;
}
else
{
// opposite of the above
}
처럼 내 현재 코드는 모습입니다.
행에 다른 셀이 있습니까? – ConnorsFan
@ConnorsFan 예 – fahadash