0

Got a little further, so updating:

Using bootstrap as UI, have a group of radio buttons that are styled by bootstrap as such:

 <div id="radio-group-follow" class="btn-group" data-toggle="buttons">
    <asp:RadioButton GroupName="myGroup1" OnCheckedChanged="Radio1_CheckedChanged"
     AutoPostBack="true" ID="Radio1" runat="server" Checked="False"
     CssClass="btn btn-default" Text="1"></asp:RadioButton>
</div>

So normally, the above code should trigger postback on its own. Bootstrap wraps the buttons with a DIV which blocks the postback from happening.

The following JS will fire 1 post back, but only works once...

$(function () {
$("#<%=Radio1.ClientID%>").change(function (event) {
         __doPostBack('Radio1', '');
     });
DDulla
  • 659
  • 9
  • 20
  • I don't believe "ifToggled" is an event in jquery. You might want to see this answer to check if the radio button is checked, http://stackoverflow.com/questions/6654601/jquery-if-radio-button-is-checked – marty Apr 02 '15 at 01:10
  • I tried using .change as well, it still wont even log to console. Worth noting that if i inspect the element and set the radio buttons to display:inline instead of none, and click the radio button, then it works. Is there a way to select the that bootstrap generates? – DDulla Apr 02 '15 at 01:54
  • I'm assuming from your code that its firing once. so, what happening is after postback your function is not initialized. SO, you need to register change event once again....that will work may be!! – Just code Apr 02 '15 at 02:34

1 Answers1

0

After the postback,your script is gone or not triggered.

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(recalc);
function recalc() {
 ...do your stuff...
}
shafiq.rst
  • 1,286
  • 1
  • 12
  • 26
Guss Davey
  • 11
  • 1
  • 1