Its driving me bit crazy on how to do a PostBack for CheckBoxList.
I have an autocomplete textbox that triggers the Javascript (on an item selected) by which I'm adding items to checkboxlist dynamically using Javascript appendChild element from the resource:
https://stackoverflow.com/a/3184505/1426121
But as told by the user in the answer, the added item disappears the very next moment, for which I have to do a PostBack (suggested by them). Also as in the comment for the answer, I need to have a *static listitem in the CheckBoxList for that Javascript to work. So here I'm summarizing the question.
Am I going in the right way to generate a CheckBoxList item? Or is there any other way?
If no other go,
- how can I do the postback for the above code?
- how can I get rid of the *static listitem? Or is there any workaround for hiding a single static listitem from a set of dynamically generated listitems?
I was so dumb for searching on SO for this silly question. Here is the answer.
Instead of appending a CheckBoxList Item with javascript,
Sample code: