这个是页面代码:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true">
</asp:GridView>
这个是cs代码: WorkFlowCommon wCommon = new WorkFlowCommon();
DataTable dt = wCommon.GetWorkFlowList(" and fd_seq=0");
GridView1.DataSource = dt;
GridView1.DataBind();看上去好像没错啊~为什么取不到数据啊?
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true">
</asp:GridView>
这个是cs代码: WorkFlowCommon wCommon = new WorkFlowCommon();
DataTable dt = wCommon.GetWorkFlowList(" and fd_seq=0");
GridView1.DataSource = dt;
GridView1.DataBind();看上去好像没错啊~为什么取不到数据啊?
dt里估计没数据的
DataTable dt = wCommon.GetWorkFlowList(" and fd_seq=0");
if(dt.Rows.Count == 0)
{
Response.Write("没有数据你绑定啥啊");
}
else
{
GridView1.DataSource = dt;
GridView1.DataBind();
}
WorkFlowCommon wCommon = new WorkFlowCommon();
DataTable dt = wCommon.GetWorkFlowList(" and fd_seq=0");
GridView1.DataSource = dt;
GridView1.DataBind();放在哪里,Page_load?
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick">
</asp:Timer>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true">
</asp:GridView>
<asp:Panel ID="dxtx" runat="server" Visible="false">
<bgsound src='./dxtx.wav' />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel> protected void Timer1_Tick(object sender, EventArgs e)
{
//如果有待办事宜,就播放声音
try
{ WorkFlowCommon wCommon = new WorkFlowCommon();
DataTable dt = wCommon.GetWorkFlowList(" and fd_seq=0");
GridView1.DataSource = dt;
GridView1.DataBind(); dt = null; DateTime freshTime = DateTime.Now; int count = wCommon.GetNewWaitMattersCount(EmpSeq, DeptNo, freshTime,FreshTimeSpan);
if (count > 0)
dxtx.Visible = true;
else
dxtx.Visible = false;
//dxtx.Visible = true; wCommon = null;
}
catch (Exception ex)
{
Response.Write(ex.Message);
} }
快速监视下dt。
应该是没有数据的.
还有这些我都是放在表格的一个单元格中的
加个UpdateProgress看看状态 <asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
等待
</ProgressTemplate>
</asp:UpdateProgress>