在线等,急,请各位高手帮忙看一下,为什么不能自已刷新..快下岗了...
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" > <ContentTemplate ><asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="2"
DataKeyNames="id" GridLines="Vertical"
Width="100%" Font-Size="12px">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="id" HeaderText="id" Visible="False" />
<asp:TemplateField HeaderText="选择">
<ItemStyle Width="50px" />
<ItemTemplate>
<asp:CheckBox ID="mycheck" runat="server" /> <asp:Timer id="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
</asp:Timer>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle BackColor="#F3F3F3" Height="22px" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#525252" Font-Bold="True" ForeColor="White" Height="22px" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView> </ContentTemplate>
</asp:UpdatePanel>
后台代码.
void adminshow()
{
sqlshow = "select * from orderline order by id desc";
DataSet ds = dbobj.GetDataSet(sqlshow, "newsclass1");
DataView dv = ds.Tables[0].DefaultView;
PagedDataSource pds = new PagedDataSource();
AspNetPager1.RecordCount = dv.Count;
pds.DataSource = dv;
pds.AllowPaging = true;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.PageSize = AspNetPager1.PageSize;
this.GridView1.DataSource = pds;
this.GridView1.DataBind();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
adminshow();
}
--------------------编程问答-------------------- 有报什么错没?猜测如下
1.操作数据库是否代码有误,看看获取DS的方法对着没
2.试试直接绑定到GRIDVIEW上,是不是绑定那里有问题
补充:.NET技术 , C#