- Home
- Forum
- ASP.NET Web Forms
- server row selected keeps firing in code behind
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
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.
- In which action rowSelected event keep firing. Share the details.
- Kindly share the stacktrace details(if you face any on console window)
- Share the product version details
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
Thanks for the update.
- Video demo to replicate the issue.
- On performing which action ServerRowSelected event keeps firing.(on Initial rendering or certain actions).
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.
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> |
- 6 Replies
- 3 Participants
-
ED Ed
- Dec 14, 2021 11:57 PM UTC
- Jan 3, 2022 02:59 PM UTC