【セル型】ButtonCommand イベントでサブウィンドウを開くと、メインウィンドウの後ろに表示される

文書番号 : 26111     文書種別 : 使用方法     最終更新日 : 2008/08/04
文書を印刷する
対象製品
SPREAD for .NET 2.5J Web Forms Edition
詳細
ButtonCommand イベントでサブウィンドウを開いた場合、メインウィンドウの後ろにサブウィンドウが表示される現象はリリースノートや製品ヘルプの制限事項と注意点「イベント」に記載されている制限事項に該当します。
この場合は、window.onload内でwindow.openを呼び出してください。

◎サンプルコード(VB)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  If Page.IsPostBack Then
    Return
  End If

  Dim bc As New FarPoint.Web.Spread.ButtonCellType
  bc.CommandName = "OpenDefault2"
  FpSpread1.ActiveSheetView.Cells(1, 1).CellType = bc
End Sub

Protected Sub FpSpread1_ButtonCommand(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SpreadCommandEventArgs) Handles FpSpread1.ButtonCommand
  If e.CommandName = "OpenDefault2" Then
    Dim startupScript As String
    startupScript = "<script>function window.onload() {window.open('Default2.aspx');}</script>"

    Me.ClientScript.RegisterStartupScript(Me.GetType, "openwindow", startupScript)
  End If
End Sub

◎サンプルコード(C#)
protected void Page_Load(object sender, EventArgs e)
{
  if (IsPostBack)
  {
    return;
  }

  FarPoint.Web.Spread.ButtonCellType bc = new FarPoint.Web.Spread.ButtonCellType();
  bc.CommandName = "OpenDefault2";
  FpSpread1.ActiveSheetView.Cells[1, 1].CellType = bc;
}

protected void FpSpread1_ButtonCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
{
  if (e.CommandName == "OpenDefault2")
  {
    string startupScript = "<script>function window.onload() {window.open('Default2.aspx');}</script>";
    ClientScript.RegisterStartupScript(this.GetType(), "openwindow", startupScript);
  }
}
キーワード
セル型

この文書は、以前は次のFAQ IDで公開されていました : 11400