javascript - Why are my rows not visible after being set to visible? -


i have table has 6 rows, starts off 2 of them visible (a header row , 1 "business" row).

the user can select button adds additional rows 1 @ time (actually, makes existing row visible), total of 6 rows / 5 "business" rows.

rows 2-6 made invisible @ first code-behind:

foapalrow3.style["display"] = "none"; 

(with same code foapalrow4, foapalrow5, , foapalrow6).

they made visible via jquery when user selects "+" button:

/* makes next hidden row visible, long there 1 */ $(document).on("click", '[id$=btnaddfoapalrow]', function (e) {     $('[id$=foapalhtmltable]').find('tr:hidden:first').show(); }); 

this works fine. problem is, when form submitted, visiblized rows revert being hidden (all first two). i'm trying add code re-visiblize these rows if text input in them given value. iow, if give "index" column value in each row so:

enter image description here

....i hope made visible again, because do have value:

enter image description here

...and visible property indeed "true":

enter image description here

...but rows remain recalcitrant, hiding in burrows. code behind that:

private void btnsave_click(object sender, eventargs e) {     try     {         . . . // code elided brevity         conditionallycreatelist();         saveinputtolist();         listoflistitems = readfromlist();         message.text = "saving data has been successful";          // expose rows vals         if (rowcontainsvals(3))         {             foapalrow3.visible = true;         }         if (rowcontainsvals(4))         {             foapalrow4.visible = true;         }         if (rowcontainsvals(5))         {             foapalrow5.visible = true;         }         if (rowcontainsvals(6))         {             foapalrow6.visible = true;         }          . . . // code elided brevity     }     catch (exception ex)     {         message.text = string.format("exception occurred: {0}", ex.message);     } }  private bool rowcontainsvals(int rownum) {     bool rowdirty = false;     switch (rownum)     {         case 3:             rowdirty = ((!string.isnullorempty(boxfund2.text)) ||                 (!string.isnullorempty(boxindex2.text)) ||                 (!string.isnullorempty(boxorganization2.text)) ||                 (!string.isnullorempty(boxaccount2.text)) ||                 (!string.isnullorempty(boxactivity2.text)) ||                 (!string.isnullorempty(boxamount2.text)));             break;         case 4:             rowdirty = ((!string.isnullorempty(boxfund3.text)) ||                 (!string.isnullorempty(boxindex3.text)) ||                 (!string.isnullorempty(boxorganization3.text)) ||                 (!string.isnullorempty(boxaccount3.text)) ||                 (!string.isnullorempty(boxactivity3.text)) ||                 (!string.isnullorempty(boxamount3.text)));             break;         case 5:             rowdirty = ((!string.isnullorempty(boxfund4.text)) ||                 (!string.isnullorempty(boxindex4.text)) ||                 (!string.isnullorempty(boxorganization4.text)) ||                 (!string.isnullorempty(boxaccount4.text)) ||                 (!string.isnullorempty(boxactivity4.text)) ||                 (!string.isnullorempty(boxamount4.text)));             break;         case 6:             rowdirty = ((!string.isnullorempty(boxfund5.text)) ||                 (!string.isnullorempty(boxindex5.text)) ||                 (!string.isnullorempty(boxorganization5.text)) ||                 (!string.isnullorempty(boxaccount5.text)) ||                 (!string.isnullorempty(boxactivity5.text)) ||                 (!string.isnullorempty(boxamount5.text)));             break;         default:             rowdirty = false;             break;     }     return rowdirty; } 

however, see after code runs:

enter image description here

so why setting visible property visible not indeed set them visible?

update

note: if re-expand rows via "+" button, do contain values added them. rows live , retain data, don't want show themselves...

try change code use style["display"] = "table-row"; instead of visible = true;

you in code behind rows made "invisible" setting style display:none.

note in asp.net making control.visible is not same making invisible style.

control.visible = false not render html code on client side while setting display:none render style hides rows on browser. assume yor case hide , show rows on client side , in order must exist on client side assume in no place in code visible = false;


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -