L
Louisa99
Hello. ive just read some posts on the age old issue of losing dynamic
control values on postback. Most people say recreate the controls on the
onInit, but i just dont think this serves my purpose. if i could explain: i
have a list of reports in a datalist. a user clicks a report link. it goes
off to reporting services, fetches the parameters for this report and
displays x number of textboxes (and labels) for those parameters (hence it
must be dynamic). i do this by adding controls to a placeholder. (they are
user controls containing labels and textboxes, validation controls etc, to
control the look and feel but for simplicity we can just say textboxes). the
user enters report parameters. hits 'run report' and i need to take those
parameters and send them to the report render method. when i am about to get
the parameters, i have to go back to those controls to get the values. but
BANG placeholder.Controls.Count = 0 . Yes my controls have all gone ( its
not that i particularly want them to stay displayed : i can probably manage
to convince the client that a refreshed screen will do (after all they have
their report flashed up in another window). but losing the text box value to
send to the parameter, and appropriate parameter name (i get that from the
label), that basically means i dont know what parameters the user wants to
send to the report. can anyone think of a way round this? Can I use
viewstate? or another 'alternative' someone knows about? my code is within
an ajax update panel too if that makes a difference. (i thought this wouldnt
happen when i was writing it as i thought its an ajax call back not a
postback. but alas i was wrong. sorry for long post and thanks in advance.
louise.
control values on postback. Most people say recreate the controls on the
onInit, but i just dont think this serves my purpose. if i could explain: i
have a list of reports in a datalist. a user clicks a report link. it goes
off to reporting services, fetches the parameters for this report and
displays x number of textboxes (and labels) for those parameters (hence it
must be dynamic). i do this by adding controls to a placeholder. (they are
user controls containing labels and textboxes, validation controls etc, to
control the look and feel but for simplicity we can just say textboxes). the
user enters report parameters. hits 'run report' and i need to take those
parameters and send them to the report render method. when i am about to get
the parameters, i have to go back to those controls to get the values. but
BANG placeholder.Controls.Count = 0 . Yes my controls have all gone ( its
not that i particularly want them to stay displayed : i can probably manage
to convince the client that a refreshed screen will do (after all they have
their report flashed up in another window). but losing the text box value to
send to the parameter, and appropriate parameter name (i get that from the
label), that basically means i dont know what parameters the user wants to
send to the report. can anyone think of a way round this? Can I use
viewstate? or another 'alternative' someone knows about? my code is within
an ajax update panel too if that makes a difference. (i thought this wouldnt
happen when i was writing it as i thought its an ajax call back not a
postback. but alas i was wrong. sorry for long post and thanks in advance.
louise.