【連結】データ連結されたSPREADの新規追加行で、カレンダー型セルをクリックしてもカレンダーがポップアップしない
対象製品
SPREAD for ASP.NET 7.0J
状況
修正済み
詳細
データ連結されたSPREADの新規追加行では、カレンダー型セルをクリックしてもカレンダーがポップアップしません。
【再現手順】
1.新規WebフォームにSPREAD、ObjectDataSourceをひとつずつ配置します
2.Webフォームに下記の再現コードを貼り付け、Web フォームを起動します
3.SPREADコマンドバーにある挿入ボタンをクリックします
4.挿入された行の第2列セルをクリックします
--- 通常表示されるカレンダーが、表示されません」
【再現コード】
------------------------------------
Webフォームクラス
------------------------------------
Imports FarPoint.Web.Spread.Extender
Imports FarPoint.Web.Spread
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack Then Return
' FpSpread1の設定
FpSpread1.ActiveSheetView.AllowDelete = True
FpSpread1.ActiveSheetView.AllowInsert = True
FpSpread1.ActiveSheetView.AutoGenerateColumns = False
FpSpread1.ActiveSheetView.RowCount = 0
FpSpread1.ActiveSheetView.ColumnCount = 3
FpSpread1.ActiveSheetView.Columns(0).DataField = "ID"
FpSpread1.ActiveSheetView.Columns(1).DataField = "A1"
FpSpread1.ActiveSheetView.Columns(2).DataField = "A2"
FpSpread1.ActiveSheetView.DataKeyField = "ID"
FpSpread1.DataSourceID = "ObjectDataSource1"
' DateCalendarCellTypeの設定
Dim dateCalendarCellType As New DateCalendarCellType()
dateCalendarCellType.DateFormat = "yyyy/MM/dd"
dateCalendarCellType.ShowEditor = True
dateCalendarCellType.TodaysDateFormat = "yyyy/MM/dd"
dateCalendarCellType.DaysModeTitleFormat = "yyyy年MM月"
FpSpread1.ActiveSheetView.Columns(1).CellType = dateCalendarCellType
' DateTimeCellType型セルの設定
Dim dateTimeCellType As New DateTimeCellType()
FpSpread1.ActiveSheetView.Columns(2).CellType = dateTimeCellType
End Sub
End Class
------------------------------------
.aspx body部
------------------------------------
<body>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<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>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeleteTest" InsertMethod="InsertTest" SelectMethod="GetTest2" TypeName="TestClass" UpdateMethod="UpdateTest">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="A1" Type="DateTime" />
<asp:Parameter Name="A2" Type="DateTime" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="A1" Type="DateTime" />
<asp:Parameter Name="A2" Type="DateTime" />
</UpdateParameters>
</asp:ObjectDataSource>
</div>
</form>
</body>
------------------------------------
TestClass.vb
------------------------------------
Imports Microsoft.VisualBasic
Imports System
Imports System.Web
Imports System.Data
Imports System.ComponentModel
Imports System.Linq
Imports System.Data.Linq
Public Class TestClass
Private ds As DataSet = New System.Data.DataSet()
‘ パス情報はご利用の環境に応じて任意にご設定ください
Private filePath As String = HttpContext.Current.Server.MapPath("~/InFiles/Test.xml")
Public Sub New()
ds.ReadXml(filePath, XmlReadMode.ReadSchema)
End Sub
Public Function GetTest() As DataSet
Return ds
End Function
Public Function GetTest2() As IQueryable
Dim query = From row In ds.Tables("test").AsEnumerable()
Select New DataClass With {
.ID = row.Field(Of Integer)("ID"),
.A1 = row.Field(Of Date)("A1"),
.A2 = row.Field(Of Date)("A2")
}
Return query.AsQueryable()
End Function
Public Sub UpdateTest(ByVal ID As Integer, A1 As DateTime, A2 As DateTime)
Dim workRow As DataRow = ds.Tables(0).Rows.Find(ID)
If workRow IsNot Nothing Then
workRow.BeginEdit()
workRow(1) = A1
workRow(2) = A2
workRow.EndEdit()
ds.WriteXml(filePath, Data.XmlWriteMode.WriteSchema)
End If
End Sub
Public Sub InsertTest(ByVal ID As Integer, A1 As DateTime, A2 As DateTime)
Dim workRow As DataRow = ds.Tables(0).NewRow()
workRow.BeginEdit()
workRow("ID") = ID
workRow("A1") = A1
workRow("A2") = A2
workRow.EndEdit()
ds.Tables(0).Rows.Add(workRow)
ds.WriteXml(filePath, Data.XmlWriteMode.WriteSchema)
End Sub
Public Sub DeleteTest(ByVal ID As Integer)
Dim workRow As DataRow = ds.Tables(0).Rows.Find(ID)
workRow.BeginEdit()
workRow.Delete()
workRow.EndEdit()
ds.WriteXml(filePath, Data.XmlWriteMode.WriteSchema)
End Sub
End Class
Public Class DataClass
Property ID As Integer
Property A1 As Date
Property A2 As Date
End Class
------------------------------------
Test.xml
------------------------------------
<?xml version="1.0" standalone="yes"?>
<dsTestA>
<xs:schema id="dsTestA" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="dsTestA" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="test">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:int" />
<xs:element name="A1" type="xs:dateTime" minOccurs="0" />
<xs:element name="A2" type="xs:dateTime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//test" />
<xs:field xpath="ID" />
</xs:unique>
</xs:element>
</xs:schema>
<test>
<ID>1</ID>
<A1>2000-01-01T00:00:00+09:00</A1>
<A2>2015-01-01T00:00:00+09:00</A2>
</test>
<test>
<ID>2</ID>
<A1>2000-01-01T00:00:00+09:00</A1>
<A2>2015-12-31T00:00:00+09:00</A2>
</test>
<test>
<ID>0</ID>
<A1>2000-01-01T00:00:00+09:00</A1>
<A2>0001-01-01T00:00:00+09:00</A2>
</test>
</dsTestA>
【再現手順】
1.新規WebフォームにSPREAD、ObjectDataSourceをひとつずつ配置します
2.Webフォームに下記の再現コードを貼り付け、Web フォームを起動します
3.SPREADコマンドバーにある挿入ボタンをクリックします
4.挿入された行の第2列セルをクリックします
--- 通常表示されるカレンダーが、表示されません」
【再現コード】
------------------------------------
Webフォームクラス
------------------------------------
Imports FarPoint.Web.Spread.Extender
Imports FarPoint.Web.Spread
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack Then Return
' FpSpread1の設定
FpSpread1.ActiveSheetView.AllowDelete = True
FpSpread1.ActiveSheetView.AllowInsert = True
FpSpread1.ActiveSheetView.AutoGenerateColumns = False
FpSpread1.ActiveSheetView.RowCount = 0
FpSpread1.ActiveSheetView.ColumnCount = 3
FpSpread1.ActiveSheetView.Columns(0).DataField = "ID"
FpSpread1.ActiveSheetView.Columns(1).DataField = "A1"
FpSpread1.ActiveSheetView.Columns(2).DataField = "A2"
FpSpread1.ActiveSheetView.DataKeyField = "ID"
FpSpread1.DataSourceID = "ObjectDataSource1"
' DateCalendarCellTypeの設定
Dim dateCalendarCellType As New DateCalendarCellType()
dateCalendarCellType.DateFormat = "yyyy/MM/dd"
dateCalendarCellType.ShowEditor = True
dateCalendarCellType.TodaysDateFormat = "yyyy/MM/dd"
dateCalendarCellType.DaysModeTitleFormat = "yyyy年MM月"
FpSpread1.ActiveSheetView.Columns(1).CellType = dateCalendarCellType
' DateTimeCellType型セルの設定
Dim dateTimeCellType As New DateTimeCellType()
FpSpread1.ActiveSheetView.Columns(2).CellType = dateTimeCellType
End Sub
End Class
------------------------------------
.aspx body部
------------------------------------
<body>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<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>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeleteTest" InsertMethod="InsertTest" SelectMethod="GetTest2" TypeName="TestClass" UpdateMethod="UpdateTest">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="A1" Type="DateTime" />
<asp:Parameter Name="A2" Type="DateTime" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="A1" Type="DateTime" />
<asp:Parameter Name="A2" Type="DateTime" />
</UpdateParameters>
</asp:ObjectDataSource>
</div>
</form>
</body>
------------------------------------
TestClass.vb
------------------------------------
Imports Microsoft.VisualBasic
Imports System
Imports System.Web
Imports System.Data
Imports System.ComponentModel
Imports System.Linq
Imports System.Data.Linq
Public Class TestClass
Private ds As DataSet = New System.Data.DataSet()
‘ パス情報はご利用の環境に応じて任意にご設定ください
Private filePath As String = HttpContext.Current.Server.MapPath("~/InFiles/Test.xml")
Public Sub New()
ds.ReadXml(filePath, XmlReadMode.ReadSchema)
End Sub
Public Function GetTest() As DataSet
Return ds
End Function
Public Function GetTest2() As IQueryable
Dim query = From row In ds.Tables("test").AsEnumerable()
Select New DataClass With {
.ID = row.Field(Of Integer)("ID"),
.A1 = row.Field(Of Date)("A1"),
.A2 = row.Field(Of Date)("A2")
}
Return query.AsQueryable()
End Function
Public Sub UpdateTest(ByVal ID As Integer, A1 As DateTime, A2 As DateTime)
Dim workRow As DataRow = ds.Tables(0).Rows.Find(ID)
If workRow IsNot Nothing Then
workRow.BeginEdit()
workRow(1) = A1
workRow(2) = A2
workRow.EndEdit()
ds.WriteXml(filePath, Data.XmlWriteMode.WriteSchema)
End If
End Sub
Public Sub InsertTest(ByVal ID As Integer, A1 As DateTime, A2 As DateTime)
Dim workRow As DataRow = ds.Tables(0).NewRow()
workRow.BeginEdit()
workRow("ID") = ID
workRow("A1") = A1
workRow("A2") = A2
workRow.EndEdit()
ds.Tables(0).Rows.Add(workRow)
ds.WriteXml(filePath, Data.XmlWriteMode.WriteSchema)
End Sub
Public Sub DeleteTest(ByVal ID As Integer)
Dim workRow As DataRow = ds.Tables(0).Rows.Find(ID)
workRow.BeginEdit()
workRow.Delete()
workRow.EndEdit()
ds.WriteXml(filePath, Data.XmlWriteMode.WriteSchema)
End Sub
End Class
Public Class DataClass
Property ID As Integer
Property A1 As Date
Property A2 As Date
End Class
------------------------------------
Test.xml
------------------------------------
<?xml version="1.0" standalone="yes"?>
<dsTestA>
<xs:schema id="dsTestA" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="dsTestA" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="test">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:int" />
<xs:element name="A1" type="xs:dateTime" minOccurs="0" />
<xs:element name="A2" type="xs:dateTime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//test" />
<xs:field xpath="ID" />
</xs:unique>
</xs:element>
</xs:schema>
<test>
<ID>1</ID>
<A1>2000-01-01T00:00:00+09:00</A1>
<A2>2015-01-01T00:00:00+09:00</A2>
</test>
<test>
<ID>2</ID>
<A1>2000-01-01T00:00:00+09:00</A1>
<A2>2015-12-31T00:00:00+09:00</A2>
</test>
<test>
<ID>0</ID>
<A1>2000-01-01T00:00:00+09:00</A1>
<A2>0001-01-01T00:00:00+09:00</A2>
</test>
</dsTestA>
回避方法
Service Pack 3(v7.0.4017.2010)で修正済み。