GridView除了绑定字段列外,一个模板列中放置了CheckBox,其余的四个模板列分别放置了TextBox1 - 4,绑定后几乎死机
<DIV style="PADDING-RIGHT: 20px; PADDING-LEFT: 20px; PADDING-BOTTOM: 20px; WIDTH: 540px; PADDING-TOP: 20px; HEIGHT: 436px; BACKGROUND-COLOR: #bfbfcd">
<DIV style="position: relative;overflow: auto; WIDTH: 529px; HEIGHT: 399px; BACKGROUND-COLOR: #f3f8fd; left: 0px; top: 0px;"; left: 0px; top: 0px;">
<cc1:TYGridView id="GVPPrice" runat="server" Width="509px" AutoGenerateColumns="False" BackColor="White" GridLines="None" BorderStyle="None" DataKeyNames="Product_ID" Height="123px" PageSize="10" >
<FooterStyle BackColor="White" ForeColor="White" Font-Bold="True"></FooterStyle>
<Columns>
<asp:TemplateField><ItemTemplate>
<asp:CheckBox id="checker" runat="server" __designer:wfdid="w14"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Product_ID" HeaderText="<%$ Resources:productid %>"></asp:BoundField>
<asp:BoundField DataField="Product_Name" SortExpression="Product_Name" HeaderText="<%$ Resources:productname %>"></asp:BoundField>
<asp:TemplateField HeaderText="<%$ Resources:xzprice %>"><ItemTemplate>
<asp:TextBox id="TxtxzPrice" runat="server" Width="76px" __designer:wfdid="w19"></asp:TextBox> <asp:RangeValidator id="RangeValidator1" runat="server" __designer:wfdid="w20" Type="Double" ControlToValidate="TxtxzPrice" ErrorMessage="*" MinimumValue="0" MaximumValue="100000"></asp:RangeValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="<%$ Resources:bjprice %>"><ItemTemplate>
<asp:TextBox id="TxtbjPrice" runat="server" Width="76px" __designer:wfdid="w21"></asp:TextBox><asp:RangeValidator id="RangeValidator2" runat="server" __designer:wfdid="w22" Type="Double" ControlToValidate="TxtbjPrice" ErrorMessage="*" MinimumValue="0" MaximumValue="100000"></asp:RangeValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="<%$ Resources:ymprice %>"><ItemTemplate>
<asp:TextBox id="TxtymPrice" runat="server" Width="76px" __designer:wfdid="w23"></asp:TextBox><asp:RangeValidator id="RangeValidator3" runat="server" __designer:wfdid="w24" Type="Double" ControlToValidate="TxtymPrice" ErrorMessage="*" MinimumValue="0" MaximumValue="100000"></asp:RangeValidator>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="<%$ Resources:qtprice %>"><ItemTemplate>
<asp:TextBox id="TxtqtPrice" runat="server" Width="76px" __designer:wfdid="w25"></asp:TextBox><asp:RangeValidator id="RangeValidator4" runat="server" __designer:wfdid="w26" Type="Double" ControlToValidate="TxtqtPrice" ErrorMessage="*" MinimumValue="0" MaximumValue="100000"></asp:RangeValidator>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<table style="width: 397px; background-color: #2ea3e9">
<tr>
<td align="center" style="width: 234px; color: #ffffff; height: 22px">
<asp:Label ID="Label1" runat="server" Font-Bold="True" ForeColor="White" Text="<%$ Resources:productid %>"></asp:Label>
</td>
<td style="height: 22px">
<asp:Label ID="Label2" runat="server" Font-Bold="True" ForeColor="White" Text="<%$ Resources:productname %>"></asp:Label>
</td>
<td style="height: 22px">
<asp:Label ID="Label3" runat="server" Font-Bold="True" ForeColor="White" Text="<%$ Resources:xzprice %>"></asp:Label>
</td>
<td style="height: 22px">
<asp:Label ID="Label4" runat="server" Font-Bold="True" ForeColor="White" Text="<%$ Resources:bjprice %>"></asp:Label>
</td>
<td style="height: 22px">
<asp:Label ID="Label5" runat="server" Font-Bold="True" ForeColor="White" Text="<%$ Resources:ymprice %>"></asp:Label>
</td>
<td style="height: 22px">
<asp:Label ID="Label6" runat="server" Font-Bold="True" ForeColor="White" Text="<%$ Resources:qtprice %>"></asp:Label>
</td>
</tr>
</table>
</EmptyDataTemplate>
<SelectedRowStyle BackColor="#D1DDF1" ForeColor="#333333" Font-Bold="True"></SelectedRowStyle>
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center"></PagerStyle>
<HeaderStyle BackColor="#2EA3E9" ForeColor="White" Font-Bold="True"></HeaderStyle>
<AlternatingRowStyle BackColor="White"></AlternatingRowStyle>
</cc1:TYGridView>
</DIV><BR /><TABLE style="WIDTH: 509px; BACKGROUND-COLOR: #6a6d70"><TBODY><TR><TD style="WIDTH: 284px"></TD><TD style="WIDTH: 40px"><asp:Button id="BtnUpdate" onclick="BtnUpdate_Click" runat="server" Text="<%$ Resources:submit %>"></asp:Button></TD><TD style="WIDTH: 24px"><asp:Button id="BtnReturn" onclick="BtnReturn_Click" runat="server" Text="<%$ Resources:return %>"></asp:Button></TD></TR></TBODY></TABLE>
</DIV>
以上是页面的前台关键代码。在后台为这个GridView绑定数据时速度非常慢(几近死机),还报告网页上有错误。我看了一下数据源才1224条记录。可是如果给GridView加上分页的话就可以很快地显示出数据来(加上:AllowPaging="true" OnPageIndexChanging="GVPPrice_PageIndexChanging">)。
我不想用分页的方式(客户也有类似要求),请问页面有什么问题吗?谢谢!
[解决办法]
你应用的别人的开发的gridview扩展吧,这个扩展本身就有很多垃圾代码,
有用到了一些js,而且你每个textbox还加了验证控件,难免会慢,你使用.net自带的gridview试试有没有
问题!先不用别人的组件,看看速度如何!
[解决办法]
数据多的话考虑分页,不然几千条显示在页面上不死才怪
[解决办法]