asp.net - Controls.Remove() does not work after CreateChildControls? -
i developing sharepoint 2010 non-visual webpart displays kind of data in big table. table rows should filtered selecting filter criterium dropdownlist part of webpart.
the onselectedindexchanged event of dropdownlist fired after createchildcontrols , before onprerender. because cells of table contain linkbuttons onclick event attached, must created in createchildcontrols in order onclick events fired.
i don't know rows of table hide until onselectedindexchanged of dropdownlist fired, create possible table rows in createchldcontrols , try remove filtered ones later in onselectedindexchanged event directly or in onprerender. rows physically removed parent table's control collection, nevertheles displayed.
as test, tried remove random rows @ end of createchildcontrols method after creating them, worked , rows not rendered.
how remove rows:
table mt = findcontrol("matrixtable") table; helpers.log("controls in table: " + mt.controls.count); foreach (int kdid in kdidsinvisible) { tablerow c = mt.findcontrol("kdrow" + kdid) tablerow; helpers.log(c.id); mt.controls.remove(c); } helpers.log("controls in table: " + mt.controls.count);
output:
controls in table: 88 controls in table: 2
but rows still rendered...
is there solution this? thank in advance!
debugging:
loop through , write screen ids of rows of table.
then loop through again, , write screen row ids deleted.
find 2 rows not delete, , see if have id @ all. there may split table cell or something.
worst case scenario, debug wp in visual studio , watch rows deleted 1 one , watch count of table see one's being skipped. try deleting rows immediate window, , see error get.
Comments
Post a Comment