記事「 SharePoint 2010 (電子メール検証フィールド) のカスタム フィールド タイプの作成」とMSDNの記事「SharePoint 2010 のカスタム フィールド タイプの作成」を使用してカスタム フィールド タイプを作成してみました。どちらの場合も、ビルド/デプロイ エラーは表示されません。しかし、新しい列を作成しようとすると、オプションのリストにカスタム フィールド タイプが表示されません。この作業を行うために、中央管理局で何かする必要がありますか? これで私を助けてください。
1611 次
1 に答える
0
コードは現在正常に動作しています。記事に記載されている手順以外に、以下のコードも追加しました。
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// add save handler only in New and Edit modes
if ((SPContext.Current.FormContext.FormMode == SPControlMode.New)
|| (SPContext.Current.FormContext.FormMode == SPControlMode.Edit))
{
SPContext.Current.FormContext.OnSaveHandler
+= new EventHandler(MyCustomSaveHandler);
}
}
protected void MyCustomSaveHandler(object sender, EventArgs e)
{
Page.Validate();
if (Page.IsValid)
{
SPContext.Current.ListItem["CM_x0020_Number"] = TextBox1.Text;
SPContext.Current.ListItem.Update();
}
else
{
// do actions instead of save
}
}
于 2013-07-09T16:00:47.727 に答える