Detecting edit/insert click client-side and cancelling row selection on edit

Thread is closed for posting
5 posts, 1 answers
  1. Telerik Admin
    Telerik Admin avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 20 Oct 2006 Link to this post


    RadGrid for ASP .NET version

    4.x and later

    .NET version

    2.x and later

    Visual Studio version

    2005 and later

    Programming language

    VB.NET, Javascript

    Browser support

    all supported by RadGrid for ASP .NET


    The demo represents how to attach client event handlers for the [Add new record] button in the command item (OnClientClick property) and the Edit link button in each grid row (passing the item index of the row on ItemCreated).
    Additionally, if client row selection is enabled for the grid, you can suppress the selection on edit action by setting the CancelBubble property of the window event argument to true.

    For further information please review the code definitions/comments in the attached web site.
  2. old man
    old man avatar
    24 posts
    Member since:
    Jul 2005

    Posted 20 Oct 2006 Link to this post

    Thanks for your reply.
  3. Sebastian
    Sebastian avatar
    9934 posts

    Posted 24 Oct 2006 Link to this post

    Additionally, when you have html control which is not available on the server, you can wire directly its onclick event and cancel the event bubbling in the corresponding handler. For cross-browser support (IE, Gecko-based browsers, etc.), you need to check whether the srcElement or the target attribute of the event object is not null.
    Below is a code excerpt from the update project (part of this post):

    <script type="text/javascript">  
    function CancelRowSelection(e)             
        e.CancelBubble = true;  
      else if(  
    <radG:GridEditCommandColumn UniqueName="EditCommandColumn" EditText='<img src="RadControls/Grid/Skins/Default/Edit.gif"  border="0" align="absmiddle" alt="Edit" onclick="CancelRowSelection(event)">' /> 

    Best wishes,
    the telerik team
  4. Answer
    Feizal Amlani
    Feizal Amlani avatar
    91 posts
    Member since:
    Feb 2007

    Posted 27 Oct 2008 Link to this post

    Thanks for the additional information on this.  I am wondering how to mimic the same behaviour by getting the data on the Page_Load client event instead of using the DataSourceID property of the Grid as shown in your examples?  It seems that when the page_load fires it reloads the grid and there is no Edit Button visible anymore.


    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">



    <script type="text/javascript">

    pageLoad() {



    function updateGrid(result){
        var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();





  5. Sebastian
    Sebastian avatar
    9934 posts

    Posted 28 Oct 2008 Link to this post

    Hello Feizal,

    When you utilize client-side binding, the second approach with html control and onclick event handling is the more appropriate because the operations in the grid will be processed client-side with asynchronous calls to the server to fetch the data or perform some action (sorting/paging/etc.) over it.

    If you have something else in mind, please start a formal support ticket and provide more information along with some code snippets from the page in question. Thus we will be able to advice you further.

    Best regards,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.