c# - Is there any OnClick event of Telerik RadGrid Command Item? -
when add commanditemdisplay="top" in telrik radgrid mastertableview, 1 button addnewrecordbutton , 1 linkbutton initinsertbutton.
now, code on onclick event i.e., button/linkbutton enable , disable based on condition.
all need is: there radcombobox (outside of radgrid) in web page , radgrid.
when first time page loads, , user forgets select item radcombobox , clicks on "add new" button of radgrid button should disable @ time , alert should come (select item combobox first)
now, when user select item radcombobox, , click on "add new" button of radgrid should perform "add" functionality //---this part done
below code (replied roman) working fine disable "add new" button , show alert.
but how create requirement using code? put line of code should work per need. please guide.
please note new in telerik controls if ask basic please forgive , try guide me in simple way.
thanks in advance.
use radgrid_itemcreated() event , attributes.add() method:
protected void radgrid1_itemcreated(object sender, griditemeventargs e) { if (e.item gridcommanditem) { button btn = (button)e.item.findcontrol("addnewrecordbutton"); btn.attributes.add("onclick", "test()"); linkbutton linkbtn = (linkbutton)e.item.findcontrol("initinsertbutton"); linkbtn.attributes.add("onclick", "test()"); } } and add function html:
<script type="text/javascript"> function test() { alert("test message"); } </script>
Comments
Post a Comment