用asp.net做一个值班的查询系统,要在页面上显示一般单位值班的那种表格:星期几,哪个部门,谁值班,联系方式是多少等等,不知道这样的表格在页面中如果显示,怎么做呢?
另外就是做好的asp.net页面,如何防止用户点击后退出错呢

解决方案 »

  1.   

    表格用repeater或gridview即可防止后退,只需在页面加载时清空缓存 Response.Buffer = true;
                    Response.ExpiresAbsolute = System.DateTime.Now.AddHours(-2);
                
                    Response.CacheControl = "no-cache";
                    Response.AddHeader("pragma", "no=cache");
      

  2.   

    gridview能做出那么变态的表格吗,能仔细说说吗
      

  3.   

    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";
      

  4.   

    http://topic.csdn.net/u/20100830/11/7da5f642-1761-43d4-b8fe-4a7f066bda98.html
      

  5.   


    此帖1L的链接你可参考参考
    还有这个

     GridView 72般绝技
      

  6.   

    可以在dw里布局好,然后放在datalist模板中
      

  7.   

    先用dw做好,再拷呗到datalists里
      

  8.   

    一直用GridView功能还行,如果数据量大,就要另作处理了
    百度,GridView72绝技,应有尽有。
      

  9.   

       用repeater吧  repeater他很灵活的`做成那样的表格没有问题的
      

  10.   

    前台
                           <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);
            }
        }