R
Robert Pettersson
Hi,
I have a old ASP-page I´m updating to ASP.Net 2.0. In my old ASP-page I
generated a table, looping through my recordset.
For that amount of rows it was very fast.
Now I´m using a GridView to present my result. But the problem is that I
need to be able to edit my rows.
So I created ItemTemplates, CommandField and events to be able to do so. It
works fine on a small resultset, but on a larger resultset it is painfully
slow!!
So I tried just throwing out a GridView and connecting it to the same
result, with BoundFields. And then it´s mush faster!
The resultset I´m trying to present is 6000 records. And the Gridview with
bound columns take ~40seconds, and the one with ItemTemplates take like 10
minutes!
And when I press the CommandField (my button) to edit, it takes another 10
minutes to go to edit mode. Why are the postbacks so slow? Do the client
redraw it eveytime? Is the only way not to redraw the whole page to use
AJAX?
The problem is not in the database, the SP I´m running takes 1 second to
execute. It is presenting the data on the client!
My old ASP-page was faster the both GridView alternatives!! How can that be?
How do I solve this? Can you not have Editable GridViews in ASP.Net that
have a larger resultset?????
Would be very greateful for any help!!!!
This is part of my 2 Gridviews:
ItemTemplates (really slow!):
<asp:GridView ID="GridViewContribWithdraw" runat="server"
AllowSorting="True" EnableViewState="false"
AutoGenerateColumns="False" AllowPaging="False" PageSize="50"
DataKeyNames="pkTransactionID"
OnPageIndexChanging="GridViewContribWithdraw_PageIndexChanging"
OnRowCancelingEdit="GridViewContribWithdraw_RowCancelingEdit"
OnRowEditing="GridViewContribWithdraw_RowEditing"
OnSorting="GridViewContribWithdraw_Sorting"
OnRowUpdating="GridViewContribWithdraw_RowUpdating">
<Columns>
<asp:TemplateField HeaderText="pkTransactionID"
SortExpression="pkTransactionID"
Visible="False">
<EditItemTemplate>
<asp:Label ID="pkTransactionID" runat="server" Text='<%#
Bind("pkTransactionID") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="LabelpkTransactionID" runat="server"
Text='<%# Eval("pkTransactionID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Imported"
SortExpression="ImportTypeName">
<EditItemTemplate>
<aspropDownList ID="ImportType" AutoPostBack="false"
SelectedValue='<%# Eval("ImportType") %>' runat="server" DataSource='<%#
GetImportTypes() %>' DataTextField="Value" DataValueField="Key">
</aspropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="LabelImported" runat="server" Text='<%#
Eval("ImportTypeName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" ShowEditButton="True">
<ControlStyle CssClass="car-button" />
</asp:CommandField>
</Columns>
<PagerSettings Position="TopAndBottom" />
</asp:GridView>
Boundfields (mush faster):
<asp:GridView ID="GridViewContribWithDrawRead" EnableViewState="false"
runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="ImportTypeName"
HeaderText="Imported"/>
<asp:BoundField DataField="PortfolioCode"
HeaderText="Portfolio"/>
<asp:BoundField DataField="OriginID" HeaderText="OriginID"
SortExpression="OriginID" />
<asp:BoundField DataField="TranTypeDescription"
HeaderText="TranType"/>
</Columns>
</asp:GridView>
/Robert
I have a old ASP-page I´m updating to ASP.Net 2.0. In my old ASP-page I
generated a table, looping through my recordset.
For that amount of rows it was very fast.
Now I´m using a GridView to present my result. But the problem is that I
need to be able to edit my rows.
So I created ItemTemplates, CommandField and events to be able to do so. It
works fine on a small resultset, but on a larger resultset it is painfully
slow!!
So I tried just throwing out a GridView and connecting it to the same
result, with BoundFields. And then it´s mush faster!
The resultset I´m trying to present is 6000 records. And the Gridview with
bound columns take ~40seconds, and the one with ItemTemplates take like 10
minutes!
And when I press the CommandField (my button) to edit, it takes another 10
minutes to go to edit mode. Why are the postbacks so slow? Do the client
redraw it eveytime? Is the only way not to redraw the whole page to use
AJAX?
The problem is not in the database, the SP I´m running takes 1 second to
execute. It is presenting the data on the client!
My old ASP-page was faster the both GridView alternatives!! How can that be?
How do I solve this? Can you not have Editable GridViews in ASP.Net that
have a larger resultset?????
Would be very greateful for any help!!!!
This is part of my 2 Gridviews:
ItemTemplates (really slow!):
<asp:GridView ID="GridViewContribWithdraw" runat="server"
AllowSorting="True" EnableViewState="false"
AutoGenerateColumns="False" AllowPaging="False" PageSize="50"
DataKeyNames="pkTransactionID"
OnPageIndexChanging="GridViewContribWithdraw_PageIndexChanging"
OnRowCancelingEdit="GridViewContribWithdraw_RowCancelingEdit"
OnRowEditing="GridViewContribWithdraw_RowEditing"
OnSorting="GridViewContribWithdraw_Sorting"
OnRowUpdating="GridViewContribWithdraw_RowUpdating">
<Columns>
<asp:TemplateField HeaderText="pkTransactionID"
SortExpression="pkTransactionID"
Visible="False">
<EditItemTemplate>
<asp:Label ID="pkTransactionID" runat="server" Text='<%#
Bind("pkTransactionID") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="LabelpkTransactionID" runat="server"
Text='<%# Eval("pkTransactionID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Imported"
SortExpression="ImportTypeName">
<EditItemTemplate>
<aspropDownList ID="ImportType" AutoPostBack="false"
SelectedValue='<%# Eval("ImportType") %>' runat="server" DataSource='<%#
GetImportTypes() %>' DataTextField="Value" DataValueField="Key">
</aspropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="LabelImported" runat="server" Text='<%#
Eval("ImportTypeName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" ShowEditButton="True">
<ControlStyle CssClass="car-button" />
</asp:CommandField>
</Columns>
<PagerSettings Position="TopAndBottom" />
</asp:GridView>
Boundfields (mush faster):
<asp:GridView ID="GridViewContribWithDrawRead" EnableViewState="false"
runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="ImportTypeName"
HeaderText="Imported"/>
<asp:BoundField DataField="PortfolioCode"
HeaderText="Portfolio"/>
<asp:BoundField DataField="OriginID" HeaderText="OriginID"
SortExpression="OriginID" />
<asp:BoundField DataField="TranTypeDescription"
HeaderText="TranType"/>
</Columns>
</asp:GridView>
/Robert