javascript - RadGrid Conditional Row PostBack -


i have radgrid on page posts when click on row, configured following:

<clientsettings enablepostbackonrowclick="true">     <selecting allowrowselect="true" />     <clientevents onrowclick="rowclick" /> </clientsettings> 

i'm trying stop postback stopping propagation of event via:

function rowclick(sender, e) {     var mastertable = sender.get_mastertableview();     var hasreport = mastertable.getcellbycolumnuniquename(e.get_item(), "hasreport").innerhtml;      if (hasreport.trim() == "no") {         e.get_domevent().preventdefault();         e.get_domevent().stoppropagation();     } } 

but isn't working; postback still happens. have grid 2 records, , need postback when field has value of "yes", can't work. i'm sure it's hitting no condition, after stopping propagation, event still fires. idea how stop postback? can't use rowselecting because never fires, since i'm posting on row click.

drop enablepostbackonrowclick - set false. add radajaxmanager, if don't have 1 already, , trigger postback hand. try this:

<telerik:radajaxmanager runat="server" id="ajaxmgr"></telerik:radajaxmanager> <script type="text/javascript">  function rowclick(sender, args) {     var mastertable = sender.get_mastertableview();     var id = mastertable.getcellbycolumnuniquename(args.get_item(), "id").innerhtml;      if (id == "1") {         var ajaxmgr = $find("<%= ajaxmgr.clientid %>");         ajaxmgr.ajaxrequestwithtarget("<%= grid.uniqueid %>", id);     }  }  </script> 

you need handle raisepostbackevent method on codebehind:

protected override void raisepostbackevent(ipostbackeventhandler sourcecontrol, string eventargument) {      // interesting } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -