请问主页的gridview自动刷新问题 很大可能是CSS写的有问题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个要看xxx.aspx和xxx.aspx.cs代码,你是怎样写的。更多技术支持:http://insus.cnblogs.com 数据绑定GridView控件自动更新数据设置 <div> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <table> <tr> <td> <asp:GridView ID="gvDetail" runat="server" AutoGenerateColumns="False" DataMember="GoodsTypeID" EmptyDataText="暂无商品明细!" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" AllowPaging="True" onpageindexchanging="gvDetail_PageIndexChanging" PageSize="2" style="font-size: small"> <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /> <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /> <Columns>//codego.net/tags/15/1/ <asp:BoundField DataField="GoodsName" HeaderText="商品名称" /> <asp:BoundField DataField="GoodsIntroduce" HeaderText="商品介绍" /> <asp:BoundField DataField="GoodsPrice" HeaderText="商品价格" /> <asp:TemplateField HeaderText="商品图像"> <ItemTemplate> <asp:Image id="ProductImage" ImageUrl='<%# Eval( "GoodsPhoto") %>' runat="server"/> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="订购数量"> <ItemTemplate> <asp:UpdatePanel ID="QuantityUpdatePanel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <font size="1"><%=DateTime.Now.ToString("hh:mm:ss")%></font> <asp:Label ID="lblQuantity" Text="0" runat="server" /> <asp:Button ID="DecreaseQuantity" Text="-" OnClick="DecreaseQuantity_Click" runat="server" /> <asp:Button ID="IncreaseQuantity" Text="+" OnClick="IncreaseQuantity_Click" runat="server" /> </ContentTemplate> </asp:UpdatePanel> </ItemTemplate> </asp:TemplateField> </Columns> <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /> </asp:GridView> </td> <td style="font-weight: 700"> <asp:UpdatePanel ID="SummaryUpdatePanel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Button ID="btnGetSummary" runat="server" CommandArgument='<%# Eval("GoodsTypeName") %>' CommandName="ShowSummary" Text="显示订货数量" onclick="btnGetSummary_Click" /> <br /> <asp:Label ID="lblSummary" runat="server" BackColor="#FFFFC0" BorderStyle="Outset" Width="224px"></asp:Label> </ContentTemplate> </asp:UpdatePanel> </td> </tr> </table> </div>//绑定控件显示数据信息protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.gvDetail.DataSource = GetDetailGoods(); this.gvDetail.DataKeyNames = new string[] { "GoodsTypeID" }; this.gvDetail.DataBind(); } }//获取明细表中数据 private DataTable GetDetailGoods() { string strsql = "select * from tb_GoodsInfo1 "; return GetDataBySql(strsql); }//根据传递的SQL语句将查询表存储到内存表中 private DataTable GetDataBySql(string strSql) { string strCon = ConfigurationManager.AppSettings["conStr"]; SqlConnection conn=new SqlConnection(strCon);//创建数据连接对象 SqlDataAdapter da = new SqlDataAdapter(strSql, conn);//创建数据适配器 DataTable dt = new DataTable();//创建内存表 da.Fill(dt);//填充内存表 return dt; }//其他(略) 有可能是两个问题:1.CSS语句不严密。2.该清缓存了亲。 可以试试在page_load里写page.databind(); 看看行不行 如果是css'缓存问题,所有的数据都会有样式异常。建议用chrome浏览器,右键查看元素,看新加入的数据的样式和原有数据是否一致。IE调试模式下也可以查看,不过没那么强大。 (在线等)sql server 采用触发器记录对表的操作 MVC3急急急急!! 关于"最新上传"的功能设计. URL重写后,Button_Click错误 DataList问题 关于web.config的问题 一个公共的信息怎么看多少人查看过了? 如何读取access表中字段的说明?最好用sql语句实现? 紧急求助!!在应用.net的web程序时,IE浏览器突然死机,在这种情况下,怎样才能引发一个事件呢? Replace在类或命名空间survey.WebForm1中不存在!???什么地方的错? 在线等待! 如何将结果集转成json字符串,方法怎么改,在线等 求SQL语句
更多技术支持:
http://insus.cnblogs.com
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<table>
<tr>
<td>
<asp:GridView ID="gvDetail" runat="server" AutoGenerateColumns="False"
DataMember="GoodsTypeID" EmptyDataText="暂无商品明细!" BackColor="#DEBA84"
BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3"
CellSpacing="2" AllowPaging="True"
onpageindexchanging="gvDetail_PageIndexChanging" PageSize="2"
style="font-size: small">
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<Columns>//codego.net/tags/15/1/
<asp:BoundField DataField="GoodsName" HeaderText="商品名称" />
<asp:BoundField DataField="GoodsIntroduce" HeaderText="商品介绍" />
<asp:BoundField DataField="GoodsPrice" HeaderText="商品价格" />
<asp:TemplateField HeaderText="商品图像">
<ItemTemplate>
<asp:Image id="ProductImage" ImageUrl='<%# Eval( "GoodsPhoto") %>' runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="订购数量">
<ItemTemplate>
<asp:UpdatePanel ID="QuantityUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<font size="1"><%=DateTime.Now.ToString("hh:mm:ss")%></font>
<asp:Label ID="lblQuantity" Text="0" runat="server" />
<asp:Button ID="DecreaseQuantity" Text="-" OnClick="DecreaseQuantity_Click" runat="server" />
<asp:Button ID="IncreaseQuantity" Text="+" OnClick="IncreaseQuantity_Click" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
</asp:GridView>
</td>
<td style="font-weight: 700">
<asp:UpdatePanel ID="SummaryUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="btnGetSummary" runat="server"
CommandArgument='<%# Eval("GoodsTypeName") %>' CommandName="ShowSummary"
Text="显示订货数量" onclick="btnGetSummary_Click" />
<br />
<asp:Label ID="lblSummary" runat="server" BackColor="#FFFFC0"
BorderStyle="Outset" Width="224px"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</div>
//绑定控件显示数据信息
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.gvDetail.DataSource = GetDetailGoods();
this.gvDetail.DataKeyNames = new string[] { "GoodsTypeID" };
this.gvDetail.DataBind();
}
}
//获取明细表中数据 private DataTable GetDetailGoods()
{
string strsql = "select * from tb_GoodsInfo1 ";
return GetDataBySql(strsql);
}
//根据传递的SQL语句将查询表存储到内存表中
private DataTable GetDataBySql(string strSql)
{
string strCon = ConfigurationManager.AppSettings["conStr"];
SqlConnection conn=new SqlConnection(strCon);//创建数据连接对象
SqlDataAdapter da = new SqlDataAdapter(strSql, conn);//创建数据适配器
DataTable dt = new DataTable();//创建内存表
da.Fill(dt);//填充内存表
return dt;
}//其他(略)
1.CSS语句不严密。
2.该清缓存了亲。