我见过很多人以我个人认为效率不高的方式显示数据记录,我正在遵循这些方法,但并不满意,因为我认为在应用程序生命周期的某个时刻,数据记录可能会达到巨大的数量,这样,在遍历所有记录,生成数据,然后将该数据打印到浏览器时,会减慢应用程序的执行和性能,例如看看这段代码,
var query2 = from m in JE.J_Posted_Jobs_Tbl
join n in JE.J_Genders_Tbl on m.J_Job_Location equals n.J_Gender_ID
select new {
m.J_Job_ID,
m.J_Job_Title,
m.J_Job_Description,
m.J_Job_Package,
m.J_Job_Timing,
n.J_Gender
};
string datarow = "";
foreach(var result in query2 ){
datarow = datarow + "<div class='eachjob'>"+
"<a href='Employeer-Details.aspx'>"+
"<div class='eachjobCompanyImg'>"+
"<img src='includes/images/premiummembers/premiummeber1.gif' width='60' height='60'/>"+
"</div>"+"</a>"+"<div class='eachjobName'>
<a href='Jobs-Details.aspx?J_PostedJob_ID="+result.J_Job_ID+"'>"+result.J_Job_Title+"
</a>
</div>"+"<div class='eachjobName'>Islamabad</div>"+
"<div class='eachjobDescription'>"+
""+result.J_Job_Description+""+
"</div>"+
"<div class='eachjobName'>"+result.J_Job_Package+"</div>"+
"<div class='eachjobName'>"+result.J_Job_Timing+"</div>"+
"<div class='eachjobName'>"+result.J_Gender+"</div>"+
"<div class='eachjobFuncDiv'>"+
"<div class='eachjobFunDivBlock'>"+
"<div class='eachjobFunDivBlockImg'>"+
"<img src='includes/images/jobFunLogos/jobMarkHired.png' />"+
"</div>"+
"<div class='eachjobFunDivBlockName'>Mark Hired</div>"+
"</div>"+
"<div class='eachjobFunDivBlock'>"+
"<div class='eachjobFunDivBlockImg'>"+
"<img src='includes/images/jobFunLogos/jobMakeDisApply.png' />"+
"</div>"+
"<div class='eachjobFunDivBlockName'>Disable Job</div>"+
"</div>"+
"</div></div>";
}
YourPostedJobs.InnerHtml = datarow;
is this method any efficient? If not, plz tell me an efficient way which is
application friendly.
Thanks in advance!