Hello,
(I am using the Q3 2008 release of the ASP.NET ajax components)
I have a RadGrid with "EnablePostBackOnRowClick" enabled. I only want this postback to occur in certain situations though. In the older versions of the RadGrid, I could have a javascript handler that did t his:
function radGrid_RowClick(sender, eventArgs)
{
eventArgs.set_cancel(true);
}
But, this does not work with the Q3 2008 release. What is the equivalent functionality?
Kind regards,
Andy
7 Answers, 1 is accepted

RowClick client-side event cannot be canceled in the current version of RadControls for ASP.NET AJAX. You can refer to the following forum link which discusses on a similar scenario:
set_cancel in OnRowClick event
Thanks
Princy.

Hi
Thanks for your response. I notice in the other forum topic, no alternative was given, so I assume there isn't one. In which case, can anyone suggest a work around for my problem?
In my RadGrid, I need to fire a postback when a row is clicked on, unless the element they are clicking on is a checkbox.
Kind regards,
Andy
It is possible to disable postback by default (EnablePostBackOnRowClick="false"). In this way you can invoke postback or ajax request manually.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Hi,
Thank you for your response. Is it possible for you to give me sample javascript code that I could use to invoke a Postback as though the postback were being caused by clicking on a row when EnablePostBackOnRowClick is true?
Kind regards,

You can try out the following code enable postback on click of the row on client side when EnablePostBackOnRowClick is set to false.
aspx:
<telerik:RadGrid AllowCustomPaging="true" ID="RadGrid2" runat="server"> |
<MasterTableView > |
.... |
</MasterTableView> |
<ClientSettings EnablePostBackOnRowClick="False"> |
<ClientEvents OnRowSelected="RowSelected"/> |
<Selecting AllowRowSelect="True" /> |
</ClientSettings> |
</telerik:RadGrid> |
js:
function RowSelected(row, args) |
{ |
var e = args.get_domEvent(); |
var targetElement = e.srcElement || e.target; |
if(targetElement.tagName.toLowerCase() != "input" && (!targetElement.type || targetElement.type.toLowerCase() != "checkbox"))// && currentClickEvent) |
{ |
alert("Clicked on Row"); |
__doPostBack('<%=RadGrid2.ClientID %>'); |
} |
else |
{ |
alert("Clicked on CheckBox"); |
} |
} |
Thanks
Princy.

doPostBack('<%=grdReviewer.ClientID %>'); |
object expected error...
here is what it creates when stepping through...
doPostBack('ctl00_ctl00_ContentPlaceHolder1_ContentBody_ReviewerControl_ReviewerGrid_grdReviewer'); |

The __doPostback is ASP.NET's way of doing javascript postbacks. Make sure that you have tried __doPostBack (instead of doPostBack).
Thanks,
Princy.