0

How it supposed to work: User starts typing in a textbox. If the textbox is populated with something, i show a div with 3 radiobuttons. If the user clicks one of the radiobuttons a postback on the server is made and we retrive some data. If the user clears the textbox we should uncheck the radiobuttons and hide their container. In the next step the user writes another value in the textbox and the radiobuttons appears on the screen, with neither of them selected.

Unfortunately, if the user selects the previously selected radio, the postback (selectionchangedhandler) on the server is not fired, presumably because i didn't unchecked correctly the radio button.

Do you have any ideas hot to make this work? I can't modify the c# source code because the website is generated from a CMS

tl;dr how to notify that we have no more a selectedIndex in a radioButtonGroup in c# from javascript?

cweiske
  • 30,033
  • 14
  • 133
  • 194
fDruga
  • 269
  • 1
  • 3
  • 11
  • How about a `click` handler, instead of `changed`? – JNF Oct 28 '14 at 12:12
  • The webpage is generated by a CMS, i can't modify the aspx/c#. I am limited to javascript/jquery. Thanks for the comment though, it was also my first thought. – fDruga Oct 28 '14 at 12:16
  • 1
    Try looking at [this answer](http://stackoverflow.com/a/2117571/1305911) – JNF Oct 28 '14 at 12:18
  • Yes i had used already the .prop() to uncheck the radio. In the DOM the radio is unchecked. The issue is when that when i check it the selectionChanged in c# is not firing. If i change to another radio it fires. Thanks for the comment though. – fDruga Oct 28 '14 at 12:22
  • If in the browser you uncheck then recheck the same radio button, then as far as the server is concerned the selected value hasn't changed, i.e. in the context of the server changed means is it a differnt value to what was sent to the browser in the request. – Ben Robinson Oct 28 '14 at 12:23
  • So the only way to notify the server that we unchecked a radio button is to make a postback? I hoped that i could do this without refreshing the page. – fDruga Oct 28 '14 at 12:26
  • Wouldn't you need a postback anyway? Or how about AJAX? – JNF Oct 28 '14 at 13:10
  • No, the postback is required only when the user selects a radio. When the user modifies the textbox's value i don't want a postback but i want to deselect all the radios.. – fDruga Oct 28 '14 at 13:34
  • Show us the part of the code that you've – Koti Panga Oct 28 '14 at 20:03

0 Answers0