This is a migrated thread and some comments may be shown as answers.

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

8 Answers 350 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aewin
Top achievements
Rank 1
Aewin asked on 24 Aug 2011, 08:32 AM
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.

8 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Aug 2011, 08:51 AM
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.
0
Aewin
Top achievements
Rank 1
answered on 24 Aug 2011, 10:23 AM
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.
0
Aewin
Top achievements
Rank 1
answered on 25 Aug 2011, 07:13 AM
Hello,

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

Regards,
Aewin.
0
Accepted
Andrey
Telerik team
answered on 29 Aug 2011, 11:07 AM
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 >>

0
Aewin
Top achievements
Rank 1
answered on 09 Sep 2011, 07:15 AM
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.
0
Emmanuel
Top achievements
Rank 1
answered on 19 Jul 2012, 02:27 PM

function

 

 

RowDblClick(sender, eventArgs) {

 

eventArgs.set_cancel(

 

true);

 

 

 

}

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

0
Eyup
Telerik team
answered on 24 Jul 2012, 10:50 AM
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.
0
Emmanuel
Top achievements
Rank 1
answered on 24 Jul 2012, 01:59 PM
Thank you..This worked..
Tags
Grid
Asked by
Aewin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Aewin
Top achievements
Rank 1
Andrey
Telerik team
Emmanuel
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or