Slow DataBind()

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="&lt;img src=&quot;Images/trashcan.gif&quot;
border=&quot;0&quot;&gt;" CommandName="Delete">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
<asp:BoundColumn Visible="False" DataField="Objektsinfo"
HeaderText="ObjektsinfoTooltip"></asp:BoundColumn>
</Columns>
</asp:datagrid>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,931
Messages
2,570,085
Members
46,536
Latest member
keelop

Latest Threads

Top