积极答复者
为啥gridview后面两列在f5之后,不再浏览器里面显示呢?

问题
-
default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div style="text-align: center">
<table border="0" cellpadding="0" cellspacing="0" style="width: 638px; height: 338px">
<tr>
<td style="width: 100px">
</td>
<td style="width: 100px">
</td>
<td style="width: 100px">
</td>
</tr>
<tr>
<td style="width: 100px; height: 261px">
</td>
<td style="width: 100px; height: 261px">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
Height="199px" Width="423px" CellPadding="4" ForeColor="#333333" GridLines="None">
<Columns>
<asp:BoundField DataField="MerchandiseID" HeaderText="商品编号" SortExpression="MerchandiseID" />
<asp:BoundField DataField="Name" HeaderText="商品名称" SortExpression="Name" />
<asp:BoundField DataField="Sort" HeaderText="商品类型" SortExpression="Store" />
<asp:BoundField DataField="Price" HeaderText="商品价格" SortExpression="Price" />
<asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="particular.aspx?id={0}"
HeaderText="查看详细信息" NavigateUrl="~/particular.aspx" Text="详细信息" />
<asp:BoundField DataField="Presentation" HeaderText="Presentation" SortExpression="Presentation" />
<asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="particular.aspx?id={0}"
HeaderText="Details" NavigateUrl="~/particular.aspx" Text="..." />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:mr_08ConnectionString2 %>"
SelectCommand="SELECT * FROM [MerchandiseInfo]"></asp:SqlDataSource>
</td>
<td style="width: 100px; height: 261px">
</td>
</tr>
<tr>
<td style="width: 100px; height: 19px">
</td>
<td style="width: 100px; height: 19px">
</td>
<td style="width: 100px; height: 19px">
</td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
web.config
<?xml version="1.0"?>
<!--
注意: 除了手动编辑此文件以外,您还可以使用
Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
“网站”->“Asp.Net 配置”选项。
设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
\Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<configuration>
<appSettings/>
<connectionStrings>
<add name="mr_08ConnectionString" connectionString="Data Source=localhost;Initial Catalog=mr_08;User ID=sa"
providerName="System.Data.SqlClient" />
<add name="mr_08ConnectionString2" connectionString="Data Source=localhost;Initial Catalog=mr_08;User ID=sa1;pwd=sa1"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--
设置 compilation debug="true" 将调试符号插入
已编译的页面中。但由于这会
影响性能,因此只在开发过程中将此值
设置为 true。
-->
<compilation debug="true"/>
<!--
通过 <authentication> 节可以配置 ASP.NET 使用的
安全身份验证模式,
以标识传入的用户。
-->
<authentication mode="Windows"/>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
maiyude
答案
全部回复
-
谢谢楼上的各位大大,今天偶又试了一下,啥也没改,啥也没动。居然出来了,偶怀疑试缓存的关系,请问偶想要保存后立即调新的,缓存应该怎样设置,谢谢。
另外,谢谢楼上的大大,您给了偶itemtemplate代码,可是偶也不知道怎么加进去,汗。
多谢拉。
maiyude