Tag: htmltable control

如何通过jQuery显示以前隐藏的HtmlTableRow?

我有一个有四行的HtmlTable。 前两个(“列标题”行和常规数据行)始终显示。 如果用户选择“+”按钮,则应添加另一个按钮,然后添加另一个按钮(最多四行)。 这两个“hibernate”行是在C#中创建的,但最初通过将其高度设置为0来“隐藏”(无论如何,这是意图): boxIndex2 = new TextBox() { CssClass = “finaff-webform-field-input”, Width = TEXTBOX_WIDTH, Height = 0, ID = “boxIndex2foapalrow3” }; cellColIndex2.Controls.Add(boxIndex2); 注意:这只是HtmlTableRow中六个“文本框”之一; 所有这些都将其高度设置为0。 这部分有效: 如您所见,第三行和第四行很短,但不是不可见/隐藏。 单击“+”按钮可以使它们达到最大高度: …再次选择“+”按钮“膨胀”最后一个缩短的行: 我用的jQuery是: $(document).on(“click”, ‘[id$=btnAddFoapalRow]’, function (e) { var textboxHeight = 15; if ($(‘[id$=boxIndex2foapalrow3]’).height() === 0) { $(‘[id$=boxIndex2foapalrow3’).height(textboxHeight); $(‘[id$=boxFund2foapalrow3’).height(textboxHeight); $(‘[id$=boxOrg2foapalrow3’).height(textboxHeight); $(‘[id$=boxAccount2foapalrow3’).height(textboxHeight); $(‘[id$=boxActivity2foapalrow3’).height(textboxHeight); $(‘[id$=boxAmount2foapalrow3’).height(textboxHeight); } else if ($(‘[id$=boxIndex3foapalrow4]’).height() === […]