How to enable or disable rowdouble click property of radgrid from serverside based on some condition

9 posts, 1 answers
  1. Aewin
    Aewin  avatar
    19 posts
    Member since:
    Aug 2011

    Posted 24 Aug 2011 Link to this post

    Dear Telerik Team,

    When I tried the following code,the whole page disappears.

     protected void RadGrid1PreRender(object sender, EventArgs e)
        {
            
                    if (Condition) 
                        RadGrid1.ClientSettings.ClientEvents.OnRowDblClick = "true";
                    else
                        RadGrid1.ClientSettings.ClientEvents.OnRowDblClick = "false";*/
        
        }


    Thanks in advance.

  2. Shinu
    Shinu avatar
    17004 posts
    Member since:
    Mar 2007

    Posted 24 Aug 2011 Link to this post

    Hello Aewin,

    I tried the same scenario in this version 2011.1.315.35 and it worked as expected. Also try populating the grid with Advanced Data-binding.Check the following documentation.
    Advanced Data-binding (using NeedDataSource event)

    Thanks,
    Shinu.

  3. Aewin
    Aewin  avatar
    19 posts
    Member since:
    Aug 2011

    Posted 24 Aug 2011 Link to this post

    Hello Shinu,

    I've already tried.Still not ok. Actually I just would like to enable or disable rowdouble click property of radgrid from serverside based on user permission.

    How can I solve??

    Thanks.

  4. Aewin
    Aewin  avatar
    19 posts
    Member since:
    Aug 2011

    Posted 25 Aug 2011 Link to this post

    Hello,

    What's wrong??
    Not yet reply anything to my question.

    Regards,
    Aewin.

  5. Answer
    Andrey
    Admin
    Andrey avatar
    836 posts
    Member since:
    Sep 2012

    Posted 29 Aug 2011 Link to this post

    Hi Aewin ,

    Note that RadGrid1.ClientSettings.ClientEvents.OnRowDblClick is a property that holds the name of the event handler for the OnRowDblClick event and is not used to toggle row double click. So assigning value "true" or "false" based on some condition is inappropriate unless you have event handlers called "true" and "false". To achieve the desired functionality you could hook the event and check the conditions in it. If they are not met  cancel the event by executing the following command: eventArgs.set_cancel(true) otherwise you could do your custom logic.

    I am also attaching a sample project to illustrate the recommended approach.

    Regards,
    Andrey
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Aewin
    Aewin  avatar
    19 posts
    Member since:
    Aug 2011

    Posted 09 Sep 2011 Link to this post

    Thanks Andrey.It does work well now.

    First time,I just referred the following link.
    http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-enable-or-disable-rowdouble-click-property-of-radgrid-from-serverside-based-on-some-condition.aspx

    Anyway,finally I got the solution.

  7. Emmanuel
    Emmanuel avatar
    10 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2012 Link to this post

    function

     

     

    RowDblClick(sender, eventArgs) {

     

    eventArgs.set_cancel(

     

    true);

     

     

     

    }

    looks like setting this code is not working. Any other ideas!.

  8. Eyup
    Admin
    Eyup avatar
    1429 posts
    Member since:
    Sep 2012

    Posted 24 Jul 2012 Link to this post

    Hi Emmanuel,

    Could you please try to use return on given condition met?

    I have created a sample RadGrid web site where alert is fired only on double-clicking the rows with even index number. On my side everything works as expected and the suggested approach successfully cancels the RowDblClick event on odd rows. Please check out the attached application and let me know if you need further assistance.

    All the best,
    Eyup
    the Telerik team

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.

  9. Emmanuel
    Emmanuel avatar
    10 posts
    Member since:
    Jul 2012

    Posted 24 Jul 2012 Link to this post

    Thank you..This worked..

Back to Top