We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Clear row selection

Thread ID:





143864 Apr 8,2019 01:35 PM UTC Apr 9,2019 07:32 AM UTC ASP.NET Web Forms 1
Tags: Grid
Fabio Marcos Euzebio
Asked On April 8, 2019 01:35 PM UTC

Hi friends,

Sorry for my simple question, but I have searched here and have found no clue on how to deselect (clear selection) on code behind.

Here´s what I´m doing:

<asp:UpdatePanel ID="updPanel" runat="server">
<ej:Grid ID="MyGrid" runat="server" Width="300px" Height="345px" AllowTextWrap="True" Locale="en-US"  DataSourceCachingMode="Session" >
                                      <ej:Column Field="groupID"   HeaderText="Group" TextAlign="Left" HeaderTextAlign="Left" HeaderTooltip="Group ID" />
      <ej:Column Field="groupName" HeaderText="Group" TextAlign="Left" HeaderTextAlign="Left" HeaderTooltip="Group Name"/>
<asp:LinkButton ID="LinkButton1" OnClick="clearSelection" runat="server" Width="150px">  Clear selection </asp:LinkButton>

public void clearSelection(object sender, EventArgs e)
this.MyGrid.SelectedRowIndex = -1;
this.MyGrid.Model.SelectedRowIndex = -1;

The code above is fired but the selected row is not unselected.
Can you please tell me what I´m missing?

Thank you in advance.

Vignesh Natarajan [Syncfusion]
Replied On April 9, 2019 07:32 AM UTC

Hi Fabio,  
Thanks for contacting Syncfusion forums 
Query: “I have searched here and have found no clue on how to deselect (clear selection) on code behind. 
From your query, we understand that you need to clear the selection from Grid in code behind. We suggest you to clear the SelectedRowindices property in server side along with your code. Refer the below modified code example 
// link button click event in server side   
protected void LinkButton1_Click(object sender, EventArgs e) 
            this.OrdersGrid.SelectedRowIndex = -1; 
            this.OrdersGrid.SelectedRowIndices.Clear(); // clear the selectedRowIndices to clear the selection 
Please get back to us if you have further queries  
Vignesh Natarajan. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon