页面表格怎么做? 用asp.net做一个值班的查询系统,要在页面上显示一般单位值班的那种表格:星期几,哪个部门,谁值班,联系方式是多少等等,不知道这样的表格在页面中如果显示,怎么做呢?另外就是做好的asp.net页面,如何防止用户点击后退出错呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 表格用repeater或gridview即可防止后退,只需在页面加载时清空缓存 Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddHours(-2); Response.CacheControl = "no-cache"; Response.AddHeader("pragma", "no=cache"); gridview能做出那么变态的表格吗,能仔细说说吗 repeater,gridview等实现多表头也可使用table看看通达OAResponse.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); Response.Expires = 0; Response.Buffer = true; Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); Response.AddHeader("pragma", "no-cache"); Response.CacheControl = "no-cache"; http://topic.csdn.net/u/20100830/11/7da5f642-1761-43d4-b8fe-4a7f066bda98.html 此帖1L的链接你可参考参考还有这个 GridView 72般绝技 可以在dw里布局好,然后放在datalist模板中 先用dw做好,再拷呗到datalists里 一直用GridView功能还行,如果数据量大,就要另作处理了百度,GridView72绝技,应有尽有。 用repeater吧 repeater他很灵活的`做成那样的表格没有问题的 前台 <table runat="server" id="table2" visible="true" border="1" align="center" cellpadding="0" cellspacing="0" class="tableborder" width="100%"></table>后台private void BindTable() { if (ViewState["strwhere"] == null) { ViewState["strwhere"] = ""; } string[] strFeild1 ={ "@UserID", "@where" }; string[] strValue1 ={ CookieUtil.GetEncryptedCookieValue("PID"), ViewState["strwhere"].ToString() }; DataTable dataDetail = SqlHelper.GetDataTable("P_GetReportPrice", 2, strValue1, strFeild1); if (dataDetail.Rows.Count > 0) { //画表头开始 HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); //画标题 cell.Attributes.Add("class", "title01"); cell.BgColor = "dfdfdf"; cell.Controls.Add(new LiteralControl("上报表")); cell.Align = "center"; cell.VAlign = "middle"; cell.ColSpan = 11; tr.Height = "26px"; tr.Controls.Add(cell); table.Rows.Add(tr); //画报告单位 tr = new HtmlTableRow(); tr.BgColor = "dfdfdf"; cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("上报单位:")); cell.Align = "center"; cell.VAlign = "middle"; cell.ColSpan = 1; tr.Height = "26px"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl(selDeptByID(CookieUtil.GetEncryptedCookieValue("PID")))); cell.Align = "left"; cell.ColSpan = 2; cell.VAlign = "middle"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("")); cell.ColSpan = 5; cell.Align = "center"; cell.VAlign = "middle"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("日期:")); cell.ColSpan = 1; cell.Align = "center"; cell.VAlign = "middle"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; string zhnDate = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString().PadLeft(2, '0') + "月" + DateTime.Now.Day.ToString().PadLeft(2, '0') + "日"; cell.Controls.Add(new LiteralControl(zhnDate)); cell.Align = "left"; cell.VAlign = "middle"; cell.ColSpan = 2; tr.Controls.Add(cell); table.Rows.Add(tr); #region 商品名称等 tr = new HtmlTableRow(); tr.BgColor = "dfdfdf"; cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); cell.Controls.Add(new LiteralControl("序号")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("商品名称")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("商品代码")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("商品类别")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("规格")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("等级")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("计量单位")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("采价点名称")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); //价格类型 cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("价格类型")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); //价格 cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); //cell.BgColor = "ffffff"; cell.Controls.Add(new LiteralControl("价格")); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); cell = new HtmlTableCell(); cell.Attributes.Add("class", "title03"); cell.Controls.Add(new LiteralControl("上报日期:")); cell.ColSpan = 2; cell.Align = "center"; cell.VAlign = "middle"; tr.Controls.Add(cell); table.Rows.Add(tr); #endregion for (int i = 0; i < dataDetail.Rows.Count; i++) { tr = new HtmlTableRow(); tr.Attributes.Add("onmouseover", "shownew(this);"); tr.Attributes.Add("onmouseout", "showold(this);"); if (i % 2 != 0) { tr.BgColor = "#ECF9FC"; } //序号 cell = new HtmlTableCell(); cell.Controls.Add(new LiteralControl((i + 1).ToString())); cell.Attributes.Add("class", "title05"); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); 、、、、、、、、、 //报告时间 cell = new HtmlTableCell(); cell.Controls.Add(new LiteralControl(dataDetail.Rows[i]["CreateDate"].ToString())); cell.Attributes.Add("class", "title05"); cell.Align = "center"; cell.VAlign = "middle"; tr.Height = "26px"; tr.Controls.Add(cell); table.Rows.Add(tr); } } else { Func.Alert("数据为空!", Page); } } 关于客户端异步处理的问题 asp.net 手动在地址栏中输入中文参数 request.querystring[参数名]是乱码 WebBrowser提交时弹出新窗口 只能取第一个值 DropDownList,请帮忙 VS2003.net与VS2005有什么不同? SHAREPOINT高手请进。 C#操作table 怎样在后台用前台的JavaScript的?请知道的人指教--在线等. 至少一个参数没有被指定值 fckeditor.net使用问题 删除服务端生成的文件,有实现,但是发布后总会出现没有权限,求代码!!! 请各位大侠帮我找下代码的错误
Response.ExpiresAbsolute = System.DateTime.Now.AddHours(-2);
Response.CacheControl = "no-cache";
Response.AddHeader("pragma", "no=cache");
也可使用table
看看通达OAResponse.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Expires = 0;
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
Response.AddHeader("pragma", "no-cache");
Response.CacheControl = "no-cache";
此帖1L的链接你可参考参考
还有这个
GridView 72般绝技
百度,GridView72绝技,应有尽有。
<table runat="server" id="table2" visible="true" border="1" align="center" cellpadding="0" cellspacing="0" class="tableborder" width="100%">
</table>后台
private void BindTable()
{
if (ViewState["strwhere"] == null)
{
ViewState["strwhere"] = "";
}
string[] strFeild1 ={ "@UserID", "@where" };
string[] strValue1 ={ CookieUtil.GetEncryptedCookieValue("PID"), ViewState["strwhere"].ToString() };
DataTable dataDetail = SqlHelper.GetDataTable("P_GetReportPrice", 2, strValue1, strFeild1); if (dataDetail.Rows.Count > 0)
{
//画表头开始
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell cell = new HtmlTableCell();
//画标题
cell.Attributes.Add("class", "title01");
cell.BgColor = "dfdfdf";
cell.Controls.Add(new LiteralControl("上报表"));
cell.Align = "center";
cell.VAlign = "middle";
cell.ColSpan = 11;
tr.Height = "26px"; tr.Controls.Add(cell);
table.Rows.Add(tr); //画报告单位
tr = new HtmlTableRow();
tr.BgColor = "dfdfdf";
cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("上报单位:"));
cell.Align = "center";
cell.VAlign = "middle";
cell.ColSpan = 1;
tr.Height = "26px";
tr.Controls.Add(cell);
cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl(selDeptByID(CookieUtil.GetEncryptedCookieValue("PID"))));
cell.Align = "left";
cell.ColSpan = 2;
cell.VAlign = "middle";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl(""));
cell.ColSpan = 5;
cell.Align = "center";
cell.VAlign = "middle";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("日期:"));
cell.ColSpan = 1;
cell.Align = "center";
cell.VAlign = "middle";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
string zhnDate = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString().PadLeft(2, '0') + "月" + DateTime.Now.Day.ToString().PadLeft(2, '0') + "日";
cell.Controls.Add(new LiteralControl(zhnDate));
cell.Align = "left";
cell.VAlign = "middle";
cell.ColSpan = 2; tr.Controls.Add(cell);
table.Rows.Add(tr);
#region 商品名称等 tr = new HtmlTableRow();
tr.BgColor = "dfdfdf"; cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
cell.Controls.Add(new LiteralControl("序号"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("商品名称"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("商品代码"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("商品类别"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("规格"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("等级"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("计量单位"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell);
cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("采价点名称"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell);
//价格类型
cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("价格类型"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell);
//价格
cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
//cell.BgColor = "ffffff";
cell.Controls.Add(new LiteralControl("价格"));
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell); cell = new HtmlTableCell();
cell.Attributes.Add("class", "title03");
cell.Controls.Add(new LiteralControl("上报日期:"));
cell.ColSpan = 2;
cell.Align = "center";
cell.VAlign = "middle";
tr.Controls.Add(cell); table.Rows.Add(tr);
#endregion for (int i = 0; i < dataDetail.Rows.Count; i++)
{ tr = new HtmlTableRow();
tr.Attributes.Add("onmouseover", "shownew(this);");
tr.Attributes.Add("onmouseout", "showold(this);");
if (i % 2 != 0)
{
tr.BgColor = "#ECF9FC";
} //序号
cell = new HtmlTableCell();
cell.Controls.Add(new LiteralControl((i + 1).ToString()));
cell.Attributes.Add("class", "title05");
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell); 、、、、、、、、、 //报告时间
cell = new HtmlTableCell();
cell.Controls.Add(new LiteralControl(dataDetail.Rows[i]["CreateDate"].ToString()));
cell.Attributes.Add("class", "title05");
cell.Align = "center";
cell.VAlign = "middle";
tr.Height = "26px";
tr.Controls.Add(cell);
table.Rows.Add(tr);
} }
else
{
Func.Alert("数据为空!", Page);
}
}