I am using asp.net grid view with sql datasource, this gridview will be triggered on update of any of the 6 dropdowns filters and I am using update panel and trigger to update on selectedindexchange event but all this does not seem to be working efficiently.
When I change a filter dropdown the gridview take about 20 sec to reload itself which is very bad.
Please suggest how I can imporve its performance and I know there are not many records also.
I am open to consider a different solution also.
The sqldatasource procedure takes around 6sec but the remaining time is delay with gridview and this is not accepted.
Having spent lot of time I dont want to give it up.
That is pretty slow. We need more information. How many rows are being returned for the data? How many columns are in your gridview? And, it might be helpful if you could post the gridview code. I'm guessing there's more than just the gridview that
is slowing the postback.
In my mind,I think since you are going to do something like Cascading Dropdownlist——When one dropdownlist goes,some related ones should also change its value……So an AJAX Dropdownlist suits you well。When you do something change,it will do changes automatically
without refreshing the whole page,and after doing all of these things,you can just do a "batchly-update"。
I have changed the procedure to increase the performance with now takes max 3 sec and it also increased the grid view efficiency to less than 5 sec.
So now you mean that you've changed to Stored procdure to shorten the loading time?
Fine,Is your problem solved?
And by the way,Maybe you can use something like jQuery's AJAX to load data asychronizedly……instead of using the whole AJAX tool but something about AJAX technology……:-)
Yes, The Stored procedure was the issue before and I still think we can make the Gridview load much faster( but could not figure out were it is taking time now).
JQuery ajax load data asynchronizedly? Can you provide some sample code to use the AJAX technology.
Can I show progrees bar with changes on gridview display? Can I have Vertical and horizontal Scroll bars? is there a sample code I can look in to?
rsrikhakollu
Member
4 Points
10 Posts
Important Grid View Performance Improvement
May 01, 2012 12:55 AM|LINK
Hi,
I am using asp.net grid view with sql datasource, this gridview will be triggered on update of any of the 6 dropdowns filters and I am using update panel and trigger to update on selectedindexchange event but all this does not seem to be working efficiently.
When I change a filter dropdown the gridview take about 20 sec to reload itself which is very bad.
Please suggest how I can imporve its performance and I know there are not many records also.
I am open to consider a different solution also.
The sqldatasource procedure takes around 6sec but the remaining time is delay with gridview and this is not accepted.
Having spent lot of time I dont want to give it up.
gridview
hoopslife
Contributor
2477 Points
483 Posts
Re: Important Grid View Performance Improvement
May 01, 2012 03:33 AM|LINK
That is pretty slow. We need more information. How many rows are being returned for the data? How many columns are in your gridview? And, it might be helpful if you could post the gridview code. I'm guessing there's more than just the gridview that is slowing the postback.
Blog
rsrikhakollu
Member
4 Points
10 Posts
Re: Important Grid View Performance Improvement
May 01, 2012 04:11 AM|LINK
The Code below is grid view code. Even a set of records with 10 takes 10-15 sec. You can see below there are 13 columns .
<asp:UpdatePanel ID="upPopulateOrders" runat="server">
<ContentTemplate >
<asp:GridView ID="gvPopulateOrders" runat="server" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="GetOrders"
onrowdatabound="gvPopulateOrders_RowDataBound" CssClass="tblClear"
ondatabound="gvPopulateOrders_DataBound" Width="130%">
<Columns>
<asp:TemplateField HeaderText="Req. Time" SortExpression="TimeType">
<ItemTemplate>
<asp:Label runat="server" ID="TimeType" Text='<%# Bind("TimeType") %>' ></asp:Label>
<asp:HiddenField runat="server" ID="hdnComments" Value='<%# Server.HtmlEncode(Convert.ToString(Eval("comments"))) %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ser/Exp Date" SortExpression="Service/ExpiryDate" >
<ItemTemplate>
<asp:Label runat="server" ID="lblServiceDate" Text='<%# DateTime.Parse(Eval("Service/ExpiryDate").ToString()).ToString("MM/dd/yyyy") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Last Service Date" SortExpression="LastServiceDate" >
<ItemTemplate>
<asp:Label runat="server" ID="lblLastServiceDate" Text='<%# DateTime.Parse(Eval("LastServiceDate").ToString()).ToString("MM/dd/yyyy") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Customer / Site Address" SortExpression="CustomerName">
<ItemTemplate>
<a title='<%# Eval("CustomerName") %> <%# Eval("comments") %>' href="javascript: fnShowOrder('<%# Eval("orderid") %>',<%# Eval("jobsiteid") %>,'<%# Eval("CustomerName") %>',<%# Eval("custid") %>,<%# Eval("fieldid") %>);">
<font color=#993399><b><asp:Label runat="server" ID="CustName" Text='<%# Bind("CustomerName") %>' ></asp:Label></b></font>
(<asp:Label runat="server" ID="OrderID" Text='<%# Bind("orderid") %>' ></asp:Label>)<br />
<font color=darkblue><b><asp:Label runat="server" ID="SiteAddr" Text='<%# Bind("addrline1") %>' ></asp:Label>
<asp:Label runat="server" ID="City" Text='<%# Bind("city") %>' ></asp:Label>,
<asp:Label runat="server" ID="State" Text='<%# Bind("statecode") %>' ></asp:Label></b></font></a>
<asp:HiddenField runat="server" ID="hfDOCID" Value='<%# Eval("DocuwareUrl") %>' />
<asp:HyperLink ID="hlDocWO" runat="server" Visible="false" ImageUrl="../../images/document.png" Text="Docuware Workorder"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Site Info" SortExpression="sitename" >
<ItemTemplate>
<a title="<%# Eval("comments") %>" href="javascript: fnShowJobsite('<%# Eval("jobsiteid") %>', '<%# Eval("orderid") %>', '<%# Eval ("CustomerName") %>', <%# Eval("custid") %>);">
<asp:Label runat="server" ID="SiteName" Text='<%# Bind("sitename") %>' ></asp:Label>
</a>
<%# Eval("SiteDiagram").ToString() == "" ? "": "<a href='javascript: fnShowDiagram(" + Eval("custid") + ", " + Eval("jobsiteid") + ");'>D</a>" %> <a href="javascript: fnShowOrderHistory(<%# Eval("custid") %>,<%# Eval("jobsiteid") %>);">H</a>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Service" SortExpression="servicetype">
<ItemTemplate>
<asp:Label runat="server" ID="ServiceType" Text='<%# Eval("servicetype") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="R/C" SortExpression="R/C" >
<ItemTemplate>
<asp:Label runat="server" ID="Category" Text='<%# Eval("R/C") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Gall" SortExpression="gallons" >
<ItemTemplate>
<asp:Label runat="server" ID="Gallons" Text='<%# Eval("gallons") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Amount" SortExpression="totalnontax">
<ItemTemplate>
<asp:Label runat="server" ID="TotalNonTax" Text='<%# "$" + Eval("totalnontax") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status" SortExpression="jobstatus">
<ItemTemplate>
<asp:Label runat="server" ID="JobStatus" Text='<%# Bind("jobstatus") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Dispatch Time" SortExpression="EstDispDate">
<ItemTemplate>
<asp:Label runat="server" ID="EstDispDate" Text='<%# Eval("EstDispDate") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Truck" SortExpression="TechAssigned">
<ItemTemplate>
<asp:Label runat="server" ID="TechAssigned" Text='<%# Eval("TechAssigned") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Job Comments" SortExpression="comments">
<ItemTemplate>
<asp:Label runat="server" ID="lblComments" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="tblHead" HorizontalAlign="Center" ForeColor="#F5DEB3"/>
<RowStyle CssClass="tblRoweven" BorderWidth="0" />
<AlternatingRowStyle CssClass="tblRowodd" BorderWidth="0" />
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="RegionalDropDown"
EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="FieldOfficeDropDown"
EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="TruckDropDown"
EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="CategoryDropDown"
EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="ServiceTypeDropDown"
EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="PriorityDropDown"
EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="JobStatusDropDown"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Important Grid View Performance Improvement
May 03, 2012 01:15 AM|LINK
Hello rsrikhakollu:)
In my mind,I think since you are going to do something like Cascading Dropdownlist——When one dropdownlist goes,some related ones should also change its value……So an AJAX Dropdownlist suits you well。When you do something change,it will do changes automatically without refreshing the whole page,and after doing all of these things,you can just do a "batchly-update"。
For Cascading Dropdownlist,you can refer to this:
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx
rsrikhakollu
Member
4 Points
10 Posts
Re: Important Grid View Performance Improvement
May 04, 2012 12:39 AM|LINK
Thanks for your reply.
The issue was with Gridview loading(databinding) and not dropdowns.
I have changed the procedure to increase the performance with now takes max 3 sec and it also increased the grid view efficiency to less than 5 sec.
I know we have Ajax controls, was trying to avoid using Ajax controls.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Important Grid View Performance Improvement
May 04, 2012 12:54 AM|LINK
So now you mean that you've changed to Stored procdure to shorten the loading time?
Fine,Is your problem solved?
And by the way,Maybe you can use something like jQuery's AJAX to load data asychronizedly……instead of using the whole AJAX tool but something about AJAX technology……:-)
rsrikhakollu
Member
4 Points
10 Posts
Re: Important Grid View Performance Improvement
May 04, 2012 03:17 PM|LINK
Yes, The Stored procedure was the issue before and I still think we can make the Gridview load much faster( but could not figure out were it is taking time now).
JQuery ajax load data asynchronizedly? Can you provide some sample code to use the AJAX technology.
Can I show progrees bar with changes on gridview display? Can I have Vertical and horizontal Scroll bars? is there a sample code I can look in to?
I appreciate your help and response.
Sandeep
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Important Grid View Performance Improvement
May 05, 2012 12:30 AM|LINK
For jQuery ajax asynchronizely:I think you should create a webservice or WCF that is used by the jQuery,and then load data contents asynchronizedly。
Sample I think you can refer to this:
http://www.mikesdotnetting.com/Article/97/Cascading-DropDownLists-with-jQuery-and-ASP.NET
Or just give your feedback about jQuery or js at:
jQuery for the ASP.NET Developer
Regaurds!