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

[Solved] Canceling row selection?

1 Answer 248 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Konstantin Vyaznikov
Top achievements
Rank 1
Konstantin Vyaznikov asked on 10 Dec 2009, 02:22 PM
What is the proper way to cancel selection of a row in RadGrid on a client side?

I try to use

ClientEvents-OnRowSelecting="cancel"

 

and in cancel function I call

 

eventArgs.set_cancel(

true);

 


This cancels selection, but row which was peviously selected remains not highlighted.

How can I highlight previously selected row back?

hanks,
Konstantin.

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 10 Dec 2009, 03:13 PM
Hi Konstantin,

You also need to cancel the RowDeselecting client event. For example:

<telerik:RadGrid
    ID="RadGrid1"
    runat="server"
    OnNeedDataSource="RadGrid_NeedDataSource">
    <ClientSettings>
        <Selecting AllowRowSelect="true" />
        <ClientEvents OnRowSelecting="MyRowSelecting" OnRowDeselecting="MyRowDeSelecting" />
    </ClientSettings>
</telerik:RadGrid>
 
<asp:CheckBox ID="CheckBox1" runat="server" Text="Cancel RadGrid Selection" />
 
<script type="text/javascript">
 
function MyRowSelecting(sender, args)
{
    if ($get("CheckBox1").checked == true)
        args.set_cancel(true);
}
 
function MyRowDeSelecting(sender, args)
{
    if ($get("CheckBox1").checked == true)
        args.set_cancel(true);
}
 
</script>

Greetings,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Konstantin Vyaznikov
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or