server row selected keeps firing in code behind

In my code behind the server row selected keeps firing? I have another page and it works fine can you see what is wrong? If I comment out the code behind playerGrid_ServerRowSelected is does not keep firing.

    <ej:Grid ID="playerGrid" runat="server" AllowPaging="True" ClientIDMode="Static" AllowFiltering="true" AllowScrolling="True" AllowSorting="True" CssClass="" DataSourceCachingMode="None" DataSourceID="playerSqlDataSource" EnableLoadOnDemand="False" MinWidth="0" AllowResizeToFit="true" EnableToolbarItems="True">

        <SelectionSettings EnableToggle="true" />

        <ClientSideEvents RowSelected="playergridrowselect" RowSelecting="playergridrowSelecting" />

        <Columns>

            <ej:Column AllowEditing="False" DataType="number" Field="player_id" IsIdentity="True" IsPrimaryKey="True" EditType="NumericEdit" HeaderText="Player Id">

            </ej:Column>

            <ej:Column DataType="string" Field="first_name">

            </ej:Column>

            <ej:Column DataType="string" Field="middle_name">

            </ej:Column>

            <ej:Column DataType="string" Field="last_name">

            </ej:Column>

            <ej:Column DataType="number" Field="suffix_id">

            </ej:Column>

            <ej:Column DataType="number" Field="gender_id" EditType="DropdownEdit" ForeignKeyField="genderid" ForeignKeyValue="gender" HeaderText="Gender">

            </ej:Column>

            <ej:Column DataType="date" Field="Birth_Dt" EditType="Datepicker" HeaderText="Birth Date">

            </ej:Column>

            <ej:Column DataType="string" Field="cellemailnotification">

            </ej:Column>

            <ej:Column DataType="string" Field="emailnotification">

            </ej:Column>

            <ej:Column DataType="string" Field="certified_ref">

            </ej:Column>

            <ej:Column DataType="date" Field="certified_ref_date">

            </ej:Column>

            <ej:Column DataType="date" Field="certified_ref_expires">

            </ej:Column>

            <ej:Column DataType="string" Field="online_userid">

            </ej:Column>

            <ej:Column DataType="string" Field="online_password">

            </ej:Column>

            <ej:Column DataType="string" Field="online_password_locked">

            </ej:Column>

            <ej:Column DataType="number" Field="online_password_tries">

            </ej:Column>

            <ej:Column DataType="date" Field="Create_Dt">

            </ej:Column>

            <ej:Column DataType="string" Field="Create_Userid">

            </ej:Column>

            <ej:Column DataType="date" Field="Update_Dt">

            </ej:Column>

            <ej:Column DataType="string" Field="Update_Userid">

            </ej:Column>

            <ej:Column DataType="string" Field="deleted">

            </ej:Column>

        </Columns>

        <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete"></ToolbarSettings>

        <EditSettings AllowEditing="True" AllowDeleting="true" AllowAdding="true" AllowEditOnDblClick="false" ShowConfirmDialog="true" ShowDeleteConfirmDialog="true" EditMode="Dialog" />

    </ej:Grid>

    function playergridrowSelecting(args) {

        val = args.data.player_id;

    }

 Private Sub playerGrid_ServerRowSelected(sender As Object, e As GridEventArgs) Handles playerGrid.ServerRowSelected

        For index As Integer = 0 To e.Arguments.Count - 1

            Dim item = e.Arguments.ElementAt(index)

            Dim itemKey = item.Key

            If itemKey = "data" Then

                playerid = item.Value("player_id")

                Exit For

            End If

        Next

        If playerid <> 999999999 Then

            Session("playerid") = playerid

            Dim filter As FilteredColumn = New FilteredColumn()

            filter.Field = "player_id"

            filter.Value = playerid

            filter.[Operator] = Syncfusion.JavaScript.FilterOperatorType.Equals

            'filter.Predicate = "and"

            'filter.MatchCase = True

            adressGrid.FilterSettings.FilteredColumns.Clear()

            adressGrid.FilterSettings.FilteredColumns.Add(filter)

            adressGrid.DataBind()

        End If

    End Sub



6 Replies

PS Pon Selva Jeganathan Syncfusion Team December 15, 2021 04:39 PM UTC

Hi Ed, 

Thanks for contacting syncfusion forum.

Query: server row selected keeps firing in code behind


We checked your query by preparing sample based on your shared code snippet, but we are unable to reproduce the issue at our end. Also in the provided code snippet we couldn’t see the serverrowselected event. Kindly ensure this property in your code.

Please refer to the attached video demo.

https://www.syncfusion.com/downloads/support/forum/171205/ze/screen-capture_(4)821440238

Please refer to the attached sample

https://www.syncfusion.com/downloads/support/forum/171205/ze/WebApplication_vb-170839113

After following the above reference, still faced issue please share us the following details.

  1. In which action rowSelected event keep firing. Share the details.
  2. Kindly share the stacktrace details(if you face any on console window)
  3. Share the product version details
 
Based on your provided details we will prevent rowSelected event fires as per your requirement. 

Regards, 
Pon selva 
 



ED Ed December 15, 2021 10:43 PM UTC

The code behind playerGrid_ServerRowSelected keeps firing I have attached the full code so you can see. The page keeps refreshing over and over and calls it. This is in Visual Studio 2022 Community Edition.


Attachment: MaintPlayer_69388222.zip


PS Pon Selva Jeganathan Syncfusion Team December 16, 2021 02:37 PM UTC

Hi Ed, 

Thanks for the update.

We are working on this query with high priority. And we need time to check this issue and will update you with further details on or before 20th December 2021In the meanwhile we will contact you if any details required. 
 
Until then we value your patience.   

Regards, 
Pon selva 



FS Farveen Sulthana Thameeztheen Basha Syncfusion Team December 21, 2021 02:21 PM UTC

  
Hi Ed,  

Sorry for the inconvenience caused. 

Further analyzing, we suspect that the reported problem may occur while using duplicate value for Primary key column. So please ensure that you have used unique value for Primary key column. Also we need some more additional details to find the exact cause of the issue. Share us the following details. 

  1. Video demo to replicate the issue.
  2. On performing which action ServerRowSelected event keeps firing.(on Initial rendering or certain actions).

From the above details we will try to replicate the issue at our end and provide you solution. If not we would like to setup webmeeting to look into your issue and find the exact cause of the issue. 

Regards, 
Farveen sulthana T 



ED Ed January 1, 2022 02:35 AM UTC

So after removing code and testing over and over I found the issue is a large amount of data coming back from the datasource grids. If I set the select in the sqldatasource to TOP 1755 to limit the page works as it should (1756 or higher and it has the issue), if I allow any more rows then it keeps firing the playerGrid_ServerRowSelected even over and over.



PS Pon Selva Jeganathan Syncfusion Team January 3, 2022 02:59 PM UTC

Hi Ed, 
 

We checked your query by preparing sample, We are able to reproduce the issue at our end. To avoid this issue, we suggest you prevent the selection using clientside’s  rowselected event.

Please refer to the below code snippet,

 
    <ej:Grid ID="OrdersGrid" runat="server"  ClientIDMode="Static" 
        AllowPaging="True"  AllowFiltering="true" AllowScrolling="True" AllowSorting="True" CssClass="" DataSourceID="SqlData"   MinWidth="0" AllowResizeToFit="true" EnableToolbarItems="True"> 
        <SelectionSettings EnableToggle="false" /> 
       
 

        <ClientSideEvents RowSelected="playergridrowselect" RowSelecting="playergridrowSelecting" />

….

<script> 
            var flag = true; 
            
  
            function playergridrowselect(args) { 
                inx = args.rowIndex; 
                if (flag == true ) { 
                    args.cancel = true; 
                    flag = false; 
                } 
                 
            } 

       </script>

 
Kindly get back to us for further assistance. 

Regards, 
Pon selva 



Loader.
Up arrow icon