【セル型】コードでコンボボックス型セルの選択項目を指定したい
対象製品
SPREAD for ASP.NET 8.0J
詳細
セルのValue プロパティにより、コンボボックス型セルの選択項目を指定することができます。
◎サンプルコード(VB)
◎サンプルコード(C#)
◎サンプルコード(VB)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Return
End If
Dim cbstr As String()
Dim cbval As String()
cbstr = New String() {"1月", "2月", "3月", "4月", "5月", "6月"}
cbval = New String() {"Jan", "Feb", "Mar", "Apr", "May", "Jun"}
Dim cmbbx As New FarPoint.Web.Spread.ComboBoxCellType(cbstr, cbval)
cmbbx.ShowButton = True
FpSpread1.ActiveSheetView.Cells(1, 1).CellType = cmbbx
FpSpread1.ActiveSheetView.Cells(1, 1).Value = "Mar"
End Sub
If IsPostBack Then
Return
End If
Dim cbstr As String()
Dim cbval As String()
cbstr = New String() {"1月", "2月", "3月", "4月", "5月", "6月"}
cbval = New String() {"Jan", "Feb", "Mar", "Apr", "May", "Jun"}
Dim cmbbx As New FarPoint.Web.Spread.ComboBoxCellType(cbstr, cbval)
cmbbx.ShowButton = True
FpSpread1.ActiveSheetView.Cells(1, 1).CellType = cmbbx
FpSpread1.ActiveSheetView.Cells(1, 1).Value = "Mar"
End Sub
◎サンプルコード(C#)
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
return;
}
string[] cbstr;
string[] cbval;
cbstr = new String[] { "1月", "2月", "3月", "4月", "5月", "6月" };
cbval = new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun" };
FarPoint.Web.Spread.ComboBoxCellType cmbbx = new FarPoint.Web.Spread.ComboBoxCellType(cbstr, cbval);
cmbbx.ShowButton = true;
FpSpread1.ActiveSheetView.Cells[1, 1].CellType = cmbbx;
FpSpread1.ActiveSheetView.Cells[1, 1].Value = "Mar";
}
{
if (Page.IsPostBack)
{
return;
}
string[] cbstr;
string[] cbval;
cbstr = new String[] { "1月", "2月", "3月", "4月", "5月", "6月" };
cbval = new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun" };
FarPoint.Web.Spread.ComboBoxCellType cmbbx = new FarPoint.Web.Spread.ComboBoxCellType(cbstr, cbval);
cmbbx.ShowButton = true;
FpSpread1.ActiveSheetView.Cells[1, 1].CellType = cmbbx;
FpSpread1.ActiveSheetView.Cells[1, 1].Value = "Mar";
}
キーワード
セル型