Mohammad Alsolaiman
asked on
Why does it take much more time binding data to gridview
Hi;
here is my story
--Total Record -- 5000 records
---Bringing Data from Database using lambda expression....
--it takes 0 second bringing data from database.....
--binding Data to gridview with DataTable it takes 10 seconds... Here is my problem
here is my story
--Total Record -- 5000 records
---Bringing Data from Database using lambda expression....
var dtTable = objHRContext.BscTbls.Select(X => X ).ToList ();
--it takes 0 second bringing data from database.....
--binding Data to gridview with DataTable it takes 10 seconds... Here is my problem
gvData.DataSource = dtTable;
gvData.DataBind();
--Here is my GridView Design view <asp:GridView ID="gv_EmpList" runat="server" AutoGenerateColumns="False"
class="table table-striped" Width="100%">
<Columns>
<asp:BoundField DataField="BscName" ItemStyle-Wrap ="true" HeaderStyle-Wrap ="true" HeaderText="الاسم" />
<asp:BoundField DataField="RankDescription" HeaderStyle-Wrap ="true" HeaderText="grade" />
<asp:BoundField DataField="BscRank_Type_Desc" HeaderStyle-Wrap ="true" HeaderText="grade type" />
<asp:BoundField DataField="Unit_Name" ItemStyle-CssClass ="styleDisPlay" HeaderStyle-CssClass ="styleDisPlay" HeaderStyle-Wrap ="true" HeaderText=" grade type " />
<asp:BoundField DataField="BscNo" HeaderStyle-Wrap ="true" HeaderText="emp number" />
<asp:BoundField DataField="LastPromDate" HeaderStyle-Wrap ="true" HeaderText="promotion date" />
<asp:BoundField DataField="Billet_Name" HeaderStyle-Wrap ="true" ItemStyle-Wrap ="true" HeaderText="billet" />
<asp:BoundField DataField="SpecialityDesc" HeaderStyle-Wrap ="true" ItemStyle-Wrap ="true" HeaderText="job tasks" />
<asp:BoundField DataField="EducationName" HeaderStyle-Wrap ="true" ItemStyle-Wrap ="true" HeaderText="qualification" />
</Columns>
</asp:GridView>
--calling my JQuery DataTables binding to Gridview
function BindDataTable() { $('[id*=gv_EmpList]').prepend($("<thead></thead>").append($('[id*=gv_EmpList]').find("tr:first"))).DataTable({
"responsive": true,
"sPaginationType": "full_numbers",
"info": false,
"ordering":false,
"bLengthChange": false,
"oLanguage":
{
"sSearch": "<b>search:</b>",
"sLengthMenu": "text _MENU_ ",
"oPaginate":
{
"sPrevious": "previous",
"sNext": "next",
"sLast": "last",
"sFirst": "first "
}
}
}); }
help me please, & thanks in advance
ASKER
I'll try it now
ASKER
sorry my friend, but I have no such property "ColumnHeadersVisible"!
You need to add it, for detailed information on this property, you can go to below link:
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridview.columnheadersvisible?view=netframework-4.7.2
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridview.columnheadersvisible?view=netframework-4.7.2
ASKER
sorry my friend, I'm using asp.net web gridview control, & I think this property ".ColumnHeadersVisible " is for window form.
Do you have sort on? SortExpression="fieldName" maybe this is causing it to index the data when it loads.
ASKER
I had try "SortExpression" my friend, and I had encountered the same delay issue.
I had try repeater and it was good to me. it consume one second only.
thank u very much jshesek, and all participated persons.
I had try repeater and it was good to me. it consume one second only.
thank u very much jshesek, and all participated persons.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You see, I had try there solutions but it doesn't fit to my case at all. Thanks to all participated experts for there trying to help me.
Open in new window
Parsing the columns takes time, the above may help to reduce the time.
Please try and let me know