I have a gridview in which one of the fields is a dropdown that runs an update routine affecting data based on an ID in its same row on dd_SelectedIndexChanged. It works, but the problem is that the peformance is bad - the screen seems to lock up for 2-10 seconds after the the dd is updated.
The gridview holds about 2200 records, and I wish to avoid using paging, and avoid having to repost the entire page because it's slow, and the user's position is lost on the page. I just want people to scroll down, find the records that apply to them (usually sequential) and update them quickly one by one.
Can anyone tell me why the perforance is so bad on this page - and what might be a better way?
here is the vb codebehind:
The gridview holds about 2200 records, and I wish to avoid using paging, and avoid having to repost the entire page because it's slow, and the user's position is lost on the page. I just want people to scroll down, find the records that apply to them (usually sequential) and update them quickly one by one.
Can anyone tell me why the perforance is so bad on this page - and what might be a better way?
Code:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>
<asp:TemplateField HeaderText="PlacementName" >
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" >
<ContentTemplate >
<asp:DropDownList ID="ddPlacementNames" runat="server" DataSourceID="dsPlacementNames" DataTextField="PlacementName"
DataValueField="PlacementNameID" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="ddPlacementNames_OnSelectedIndexChanged" >
<asp:ListItem Enabled="true" Selected="true" Text="Select..." Value="0" />
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
<asp:HiddenField ID="HiddenField1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
here is the vb codebehind:
Code:
Sub ddPlacementNames_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim DVta As New DV1TableAdapters.PLACEMENTTableAdapter
Dim gvr As GridViewRow = sender.parent.parent.parent.parent
Dim dd As DropDownList = gvr.Cells(8).FindControl("ddPlacementNames")
Dim intPlacementID As Integer = gvr.Cells(0).Text
Dim intNewValue As Integer = dd.SelectedValue
Dim upd As UpdatePanel = gvr.Cells(8).FindControl("UpdatePanel1")
If dd.SelectedValue <> 0 Then
DVta.UpdatePlacementNameByPlacementID(intNewValue, intPlacementID)
End If
End Sub
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
Dim gv As GridView = sender
Dim gvr As GridViewRow = e.Row
Dim dd As DropDownList
Dim DVta As New DV1TableAdapters.PLACEMENTTableAdapter
If IsPostBack = False Then
If gvr.RowType = DataControlRowType.DataRow Then
dd = gvr.Cells(8).FindControl("ddPlacementNames")
dd.SelectedValue = DVta.GetPlacementNameIDByPlacementName(gvr.Cells(0).Text)
End If
End If
End Sub