关于调用SaveChanges,你可以在client端放个Submit button。用户选完了省,让他按submit。
不过对于你这个case,我刚好有个sample,使用AJAX。你目前用的是Spread 3,应该是支持AJAX的。
server端
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (IsPostBack) Then Return
Dim c1 As New FarPoint.Web.Spread.ComboBoxCellType
c1.Items = New String() {"a", "b", "c"}
FpSpread1.Sheets(0).Columns(0).CellType = c1
End Sub
Protected Sub FpSpread1_UpdateCommand(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SpreadCommandEventArgs) Handles FpSpread1.UpdateCommand
Dim c As New FarPoint.Web.Spread.ComboBoxCellType
If Not (ReferenceEquals(e.EditValues(0), FarPoint.Web.Spread.FpSpread.Unchanged)) Then
Select Case e.EditValues(0)
Case "a"
c.Items = New String() {"a1", "a2", "a3"}
Case "b"
c.Items = New String() {"b1", "b2", "b3"}
Case "c"
c.Items = New String() {"c1", "c2", "c3"}
End Select
FpSpread1.Sheets(0).Cells(e.CommandArgument, 1).CellType = c
End If
End Sub
client端
function window.onload() {
FpSpread1.OnEditStopped=cellChanged;
}
function cellChanged() {
FpSpread1.UpdatePostbackData();
FpSpread1.CallBack("Update");
} |