asp.net - Radgrid fire RowClick Event via Javascript or Just use EnablePostbackOnRowClick -


worth discussion

what pro's / con's of firing rowclick event telerik radgrid following scenario's, work btw ;-)

scenario 1:

radgrid

onselectedindexchanged="rg_selectedindexchanged" clientsettings.enablepostbackonrowclick="true" 

code behind

protected void rg_selectedindexchanged(){} 

scenario 2:

radgrid

onitemcommand="rg_itemcommand" clientsettings.enablepostbackonrowclick="true" 

code behind

protected void rg_itemcommand() {  if(e.commandname == "rowclick") { } } 

scenario 3:

radgrid

onitemcommand="rg_itemcommand" clientsettings.clientevents.onrowclick="rg_rowclick" 

javascript

function rg_rowclick(sender, eventargs) { var index = eventargs.get_itemindexhierarchical(); sender.get_mastertableview().firecommand("rowclick", index); } 

behind

protected void rg_itemcommand() {  if(e.commandname == "rowclick") { } } 

scenario 1 & 2:

all events in radgrid fires itemcommand first. bubble event specific event such selectedindexchanged, insertcommand, updatecommand.

basically, if want before selectedindexchanged event called, want perform task in itemcommand event.

scenario 3:

scenario 3 calls server side itemcommand event client side.

it same scenario 2 unless want perform client side tasks before itemcommand called @ server side. example, "are sure want to...?"

if not need client side features, use scenario 1 or 2 more cleaner , more maintainable.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -