0
votes

I have an ext.net page containing a table built by TableLayout. It is similar with the example shown on the official demo site. (link) The only thing different is I have combo box, textbox inside those Cells, not just a bunch of panels.

Now, there is the need to dynamically hide some textboxes based on the selection of a combobox. What I have done is to set up the combobox to AutoPostBack="true" OnValueChanged="comboboxname_OnValueChanged" .

In that code-behind method comboboxname_OnValueChanged, I check the selected value and do a textboxname.Visible="false". Then I got the unexpected: the whole Cell that contains that textbox is removed. And my whole table is messed up!

Then my guess is that the Cell must remain in place to occupy the position. My next try is:

mytablelayout.Cells[5].Clear();
mytablelayout.Cells[5].Add(emptyLabel);

here, the index 5 is the table cell with the textbox I want to hide. and emptyLabel is an ext.Label which displays nothing. Unfortunately it does not work.

My third try is to build an empty cell first. then,

mytablelayout.Cells.RemoveAt(5);
mytablelayout.Cells.Insert(5, emptyCell);

I found RemoveAt(5) can be successfully executed, which again messed up my table because the next cell just moves from its supposed place. But the Insert(5, emptyCell) just never did what I want.

Now I am really at my wit's end. Can any ext.net expert give some advice? How did you manipulate the Cells in a TableLayout?

Thank you for any helpful input.

1
Why not hide the text box with styles = display:none?Mahmoud Darwish

1 Answers

0
votes

make a CSS class with display none.

    .myClass {
                display: none;
             }

set the textbox cls property to the CSS class made earlier

    textboxname.cls = "myClass";