asp:GridView加载8万+的数据时网页运行卡顿
问题现象:
1、执行按钮查询时后台查询速度快;
2、前台网页运行时造成了卡顿现象,页面出现空白没有响应
具体代码如下:
1、BLL代码
public DataTable GetAll(string HName)
{
DataTable dt = ESQL.GetTab_Sql("select ID,CYYMC,blh,hzxm,bq,ryrq,cyrq,ybdj,(case when cyzdmc is null then '默认诊断' else cyzdmc end)cyzdmc,brzt from HJY_BRXX where CYYMC = '" + HName+"'");
return dt;
}
此代码查询数据有8W+的数据
2、aspx.cs代码
protected void btn_chaxun_Click(object sender, EventArgs e)
{
string HName = this.yymc.Value.ToString();
DataTable dt = brxxbll.GetAll(HName);
brxx.DataSource = dt;
brxx.DataBind();
}
3、aspx页面代码
<asp:GridView ID="brxx" runat="server" AutoGenerateColumns="false" Width="100%" DataKeyNames="ID" HorizontalAlign="Center" style="text-align:center">
<EmptyDataTemplate>
数据为空,请点击查询
</EmptyDataTemplate>
<FooterStyle ForeColor="#ff0000" BackColor="#3B6BD1" Font-Bold="true"/>
<SelectedRowStyle Font-Bold="True" ForeColor="Navy" BackColor="#FFCC66" BorderColor="CornflowerBlue" />
<RowStyle ForeColor="#333333" BackColor="#FFFBD6" BorderColor="CornflowerBlue" BorderStyle="Solid" BorderWidth="1px" />
<HeaderStyle Font-Bold="True" ForeColor="#FFFFCC" BackColor="#3B6BD1"></HeaderStyle>
<Columns>
<asp:BoundField DataField="ID" Visible="false" />
<asp:BoundField HeaderText="医院名称" DataField="CYYMC" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField HeaderText="病历号" DataField="blh" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField HeaderText="病人姓名" DataField="hzxm" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField HeaderText="住院病区" DataField="bq" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField HeaderText="入院日期" DataField="ryrq" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField HeaderText="出院日期" DataField="cyrq" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField HeaderText="医保标志" DataField="ybdj" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField HeaderText="出院诊断" DataField="cyzdmc" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" />
<asp:BoundField HeaderText="出院标志" DataField="brzt" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" />
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink runat="server" Text="明细数据" NavigateUrl="~/病人信息查询/Getmingxi.aspx" Target="_blank"></asp:HyperLink>
</ItemTemplate>
<HeaderTemplate>
明细数据
</HeaderTemplate>
<ItemStyle HorizontalAlign="Center" Width="100px" />
</asp:TemplateField>
</Columns>
</asp:GridView>
以上代码在运行造成了页面的卡顿、无响应,求高手指点优化。