カスタムバリデーター(動的に作成される)、ここの情報が検証の概要に追加されない理由を教えてください。updatepanelのせいですか?それを機能させる方法は?私は完全に疲れ果てていますが、適切な解決策を見つけることができません...
MultiFreeSet制御コードビハインド:
protected void btnPatternAdder_Click(object sender, EventArgs eventArgs)
{
var includeEventArgs = new IncludeEventArgs();
baseTSMAlertConfigEditControlWithInclude.btnPatternAdder_Click(sender, includeEventArgs);
if (includeEventArgs.Cancel)
{
/*
var ClientValidationFunctionName = string.Format("{0}_ClientValidation", ID);
Page.ClientScript.RegisterClientScriptBlock(
GetType(),
string.Format("{0}_validationScript", ID),
string.Format("function {0}(sender, eventArgs) {{ eventArgs.errormessage = '{1}', eventArgs.IsValid = false; return; }}",
ClientValidationFunctionName,
includeEventArgs.Message));
*/
var customValidator = new CustomValidator
{
//ClientValidationFunction = ClientValidationFunctionName,
ValidationGroup = ValidationGroup,
IsValid = false,
ErrorMessage = includeEventArgs.Message,
Display = ValidationDisplayType
};
Page.Validators.Add(customValidator);
}
}
MultiFreeSetコントロールマークアップ:
<asp:UpdatePanel ID="upFreeSet" runat="server">
<ContentTemplate>
...
<asp:PlaceHolder runat="server" ID="phIncludePattern" Visible="false">
<tr>
<td class="SubHead">[IncludeCaption]</td>
<td>
<asp:TextBox ID="txtIncludePattern" runat="server" Text="" CssClass="MediumTextBox" />
</td>
<td>
<asp:Button CommandName="ListAdder" ID="btnPatternAdder" runat="server" CssClass="buttonClass displayBlock" Text="Add" OnClick="btnPatternAdder_Click" />
</td>
</tr>
<tr>
<td class="SubHead ta">[IncludedCaption]</td>
<td>
<asp:ListBox ID="lboxIncludePattern" runat="server" SelectionMode="Multiple" Rows="7" CssClass="LargeDropDownList" />
<asp:ObjectDataSource ID="odsIncludePattern" runat="server" />
</td>
<td class="ta">
<asp:Button CommandName="ListDeleter" ID="btnPatternDeleter" runat="server" CssClass="buttonClass displayBlock" Text="Delete selected" OnClick="btnPatternDeleter_Click" />
</td>
</tr>
</asp:PlaceHolder>
...
</ContentTemplate>
メインコントロールのマークアップ:
<asp:FormView>
<EditItemTemplate>
...
<ac:multiFreeSet ID="multiNodePatternInclusions" ValidationGroup="vgFrmConfigEdit" IgnoreCase="True" runat="server" Caption="Include node name patterns" IncludeCaption="Add node name pattern" IncludedCaption="Included node name patterns" />
<XXX:SaveButton ID="btnImgSave" runat="server" ValidationGroup="vgFrmConfigEdit" />
<XXX:CancelBackButton ID="btnImgCancel" runat="server" />
<asp:ValidationSummary ID="valSummary" runat="server" ValidationGroup="vgFrmConfigEdit" CssClass="NormalRed" ShowSummary="True" />
...
</EditItemTemplate>
</asp:FormView>