找回密码
 立即注册

QQ登录

只需一步,快速开始

wlp5402

银牌会员

51

主题

145

帖子

2828

积分

银牌会员

积分
2828

活字格认证

wlp5402
银牌会员   /  发表于:2012-7-5 12:16  /   查看:11321  /  回复:17
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %>

<%@ Register assembly="FarPoint.Web.Spread, Version=6.0.3505.2008, Culture=neutral, PublicKeyToken=327c3516b1b18457" namespace="FarPoint.Web.Spread" tagprefix="FarPoint" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager runat="Server" ID="ScriptManager1"></asp:ScriptManager>
        <FarPoint:FpSpread ID="FpSpread1" runat="server" BorderColor="Black"
            BorderStyle="Solid" BorderWidth="1px" Height="200" Width="400">
            <commandbar backcolor="Control" buttonfacecolor="Control"
                buttonhighlightcolor="ControlLightLight" buttonshadowcolor="ControlDark">
            </commandbar>
            <sheets>
                <FarPoint:SheetView SheetName="Sheet1">
                </FarPoint:SheetView>
            </sheets>
        </FarPoint:FpSpread>
   
    </div>
    <FarPoint:FpSpread ID="FpSpread2" runat="server" BorderColor="Black"
        BorderStyle="Solid" BorderWidth="1px" Height="200" Width="400">
        <commandbar backcolor="Control" buttonfacecolor="Control"
            buttonhighlightcolor="ControlLightLight" buttonshadowcolor="ControlDark">
        </commandbar>
        <sheets>
            <FarPoint:SheetView SheetName="Sheet1">
            </FarPoint:SheetView>
        </sheets>
    </FarPoint:FpSpread>
    </form>
</body>
</html>

//後台
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class test2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        FarPoint.Web.Spread.Extender.DateCalendarCellType dc = new FarPoint.Web.Spread.Extender.DateCalendarCellType();

        //dc.Animated = true;

        dc.DateFormat = "yyyy-MM-dd";

        //dc.EnableOnClient = true;

        //dc.ShowEditor = true;

        //dc.OnClientDateSelectionChanged = "datechange";

        FpSpread1.ActiveSheetView.Columns[0].CellType = dc;
    }
}

17 个回复

正序浏览
iceman
社区贡献组   /  发表于:2012-8-1 17:36:00
18#
回复 17楼dongpowudi的帖子

:share:
欢迎欢迎~
期待 dongpowudi 有好的使用经验也和大家分享
回复 使用道具 举报
dongpowudi
新手上路   /  发表于:2012-8-1 09:51:00
17#
学习学习,正遇到相似情况!
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-7-31 19:52:00
16#
回复 15楼wlp5402的帖子

正则表达式如下:&quot;(19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])&quot;
回复 使用道具 举报
wlp5402
银牌会员   /  发表于:2012-7-31 17:45:00
15#
還有輸入2010-22-02不會提示?
回复 使用道具 举报
wlp5402
银牌会员   /  发表于:2012-7-31 17:42:00
14#
還有一個問題就是我想輸入2001-1-1或2001-01-01都是可以的表達式要怎麼寫?
回复 使用道具 举报
wlp5402
银牌会员   /  发表于:2012-7-31 17:40:00
13#
回复 12楼iceman的帖子


360截图20120731173721343.jpg (21.68 KB, 下载次数: 31)
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-7-16 11:30:00
12#
回复 11楼wlp5402的帖子

感谢你的理解,有解决方案我会尽快通知楼主。
回复 使用道具 举报
wlp5402
银牌会员   /  发表于:2012-7-16 10:15:00
11#
回复 10楼iceman的帖子

好的,謝謝,不過上面的問題希望能盡快解決.
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-7-12 10:07:00
10#
回复 9楼wlp5402的帖子

测试代码如下:

  1.             if (IsPostBack)
  2.                 return;
  3.             FarPoint.Web.Spread.RegExpCellType regex = new FarPoint.Web.Spread.RegExpCellType();
  4.             System.Globalization.DateTimeFormatInfo timeInfo=new  System.Globalization.DateTimeFormatInfo();
  5.             timeInfo.DateSeparator=&quot;-&quot;;
  6.             regex.DateTimeFormat = timeInfo;
  7.             regex.ErrorMessage = &quot;输入格式错误。正确格式为:yyyy-MM-dd&quot;;
  8.             regex.ValidationExpression = @&quot;\d{4}-\d{2}-\d{2}&quot;;
  9.             FpSpread1.ActiveSheetView.Cells[0, 0].CellType = regex;
复制代码

效果如

Untitled.png
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部