K
kederstedt
Hi,
On my asp.net page(VS 2003, Framework 1.1) I have a Datagrid control. I
use a Stored Procedure in SQL server to get my data(120 posts), runs
fast. The page takes 6seconds to load. Via debugging I found that it's
this statement that is reeeeealy slow - myDatagrid.DataBind(); My
question is WHY? I need to make it faster. I have alreadey tried to
change viewstate, but it did not help.
See my Dg below.
----------------------------------------
<asp:datagrid id=DGProspectKund runat="server"
OnSortCommand="DGProspectKund_Sort" AllowSorting="True"
AllowPaging="True" AutoGenerateColumns="False">
<SelectedItemStyle VerticalAlign="Top"></SelectedItemStyle>
<EditItemStyle VerticalAlign="Top"></EditItemStyle>
<AlternatingItemStyle VerticalAlign="Top"></AlternatingItemStyle>
<ItemStyle VerticalAlign="Top"></ItemStyle>
<HeaderStyle ForeColor="White"></HeaderStyle>
<Columns>
<asp:ButtonColumn Text="Select" DataTextField="ProspectId"
SortExpression="ProspectId" HeaderText="ProspectID"
CommandName="Select">
<HeaderStyle Width="40px"></HeaderStyle>
<ItemStyle Wrap="False" HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
<asp:BoundColumn Visible="False" DataField="ProspectId"
SortExpression="ProspectId" HeaderText="ProspectID"></asp:BoundColumn>
<asp:BoundColumn DataField="AvtalsTypTxt" SortExpression="Avtalstyp"
HeaderText="Typ"></asp:BoundColumn>
<asp:BoundColumn DataField="Objektsinfo" SortExpression="Objektsinfo"
HeaderText="Objektsinfo"></asp:BoundColumn>
<asp:BoundColumn DataField="Baspris" SortExpression="Baspris"
HeaderText="Baspris" DataFormatString="{0:C}">
<HeaderStyle Width="80px"></HeaderStyle>
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Restvärde"
SortExpression="Restvärde" HeaderText="Slutvärde"
DataFormatString="{0:C}">
<HeaderStyle Width="70px"></HeaderStyle>
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="StatusTxt" SortExpression="StatusTxt"
HeaderText="Status">
<HeaderStyle Width="150px"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="StatusDatum" SortExpression="StatusDatum"
HeaderText="StatusDat" DataFormatString="{0:yyyy-MM-dd}">
<HeaderStyle Width="70px"></HeaderStyle>
<ItemStyle Wrap="False" HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="HuvudKund" SortExpression="Kundnamn"
HeaderText="Huvudkund">
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn>
<asp:ButtonColumn Text="<img src="Images/trashcan.gif"
border="0">" CommandName="Delete">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
<asp:BoundColumn Visible="False" DataField="Objektsinfo"
HeaderText="ObjektsinfoTooltip"></asp:BoundColumn>
</Columns>
</asp:datagrid>
On my asp.net page(VS 2003, Framework 1.1) I have a Datagrid control. I
use a Stored Procedure in SQL server to get my data(120 posts), runs
fast. The page takes 6seconds to load. Via debugging I found that it's
this statement that is reeeeealy slow - myDatagrid.DataBind(); My
question is WHY? I need to make it faster. I have alreadey tried to
change viewstate, but it did not help.
See my Dg below.
----------------------------------------
<asp:datagrid id=DGProspectKund runat="server"
OnSortCommand="DGProspectKund_Sort" AllowSorting="True"
AllowPaging="True" AutoGenerateColumns="False">
<SelectedItemStyle VerticalAlign="Top"></SelectedItemStyle>
<EditItemStyle VerticalAlign="Top"></EditItemStyle>
<AlternatingItemStyle VerticalAlign="Top"></AlternatingItemStyle>
<ItemStyle VerticalAlign="Top"></ItemStyle>
<HeaderStyle ForeColor="White"></HeaderStyle>
<Columns>
<asp:ButtonColumn Text="Select" DataTextField="ProspectId"
SortExpression="ProspectId" HeaderText="ProspectID"
CommandName="Select">
<HeaderStyle Width="40px"></HeaderStyle>
<ItemStyle Wrap="False" HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
<asp:BoundColumn Visible="False" DataField="ProspectId"
SortExpression="ProspectId" HeaderText="ProspectID"></asp:BoundColumn>
<asp:BoundColumn DataField="AvtalsTypTxt" SortExpression="Avtalstyp"
HeaderText="Typ"></asp:BoundColumn>
<asp:BoundColumn DataField="Objektsinfo" SortExpression="Objektsinfo"
HeaderText="Objektsinfo"></asp:BoundColumn>
<asp:BoundColumn DataField="Baspris" SortExpression="Baspris"
HeaderText="Baspris" DataFormatString="{0:C}">
<HeaderStyle Width="80px"></HeaderStyle>
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Restvärde"
SortExpression="Restvärde" HeaderText="Slutvärde"
DataFormatString="{0:C}">
<HeaderStyle Width="70px"></HeaderStyle>
<ItemStyle Wrap="False" HorizontalAlign="Right"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="StatusTxt" SortExpression="StatusTxt"
HeaderText="Status">
<HeaderStyle Width="150px"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="StatusDatum" SortExpression="StatusDatum"
HeaderText="StatusDat" DataFormatString="{0:yyyy-MM-dd}">
<HeaderStyle Width="70px"></HeaderStyle>
<ItemStyle Wrap="False" HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="HuvudKund" SortExpression="Kundnamn"
HeaderText="Huvudkund">
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn>
<asp:ButtonColumn Text="<img src="Images/trashcan.gif"
border="0">" CommandName="Delete">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
<asp:BoundColumn Visible="False" DataField="Objektsinfo"
HeaderText="ObjektsinfoTooltip"></asp:BoundColumn>
</Columns>
</asp:datagrid>