奇妙な問題がありますが、解決策がありません。ドロップダウンとテキスト ボックスを設定する Infragistics WebDataGrid を使用しています。両方について、次のように設定しましたrequiredfieldvalidator
。
<asp:RequiredFieldValidator ValidationGroup="attrib" runat="server" ControlToValidate="ddlIndRoleAttribType" ToolTip="Attribute Type is not set." InitialValue="-- not selected --" Text="!" Display="Dynamic" />
</div>
</ItemTemplate>
</ig:TemplateDataField>
<ig:TemplateDataField Header-Text="Value" Key="IndRoleAttribVal" Width="50%">
<ItemTemplate>
<div>
<stgwc:TextEdit runat="server" Width="300px" ID="txtIndRoleAttribValue" />
<asp:RequiredFieldValidator ValidationGroup="attrib" runat="server" ControlToValidate="txtIndRoleAttribValue" Width="90%" ToolTip="Attribute Value is not set." Text="!" Display="Dynamic" />
</div>
</ItemTemplate>
</ig:TemplateDataField>
<ig:TemplateDataField Header-Text="Action" Key="IndRoleAttribAction" Width="40px">
<HeaderTemplate>
<stgwc:ImageLinkButton runat="server" ID="btnCreateNewAttribute" CausesValidation="false" ImageUrl="~/Images/base/Icons/16x16/add2.png"
ToolTip="Add new Attribute" CommandName="Create" />
<stgwc:ImageLinkButton runat="server" ID="btnSaveAllAttributes" ValidationGroup="attrib" ImageUrl="~/Images/base/Icons/16x16/disk_green.png"
ToolTip="Save all Attributes" CommandName="Save" />
<stgwc:ImageLinkButton runat="server" ID="btnCancelChanges" CausesValidation="false" ImageUrl="~/Images/base/Icons/16x16/undo.png"
CommandName="Cancel" ToolTip="Discard changes" />
</HeaderTemplate>
<ItemTemplate>
<stgwc:ImageLinkButton runat="server" ID="btnDeleteAttribute" CausesValidation="false" ImageUrl="~/Images/base/Icons/16x16/delete2.png"
ToolTip="Delete this Attribute" CommandName="Delete" CommandArgument='<%# Bind("IR_ATTR_ID") %>' />
</ItemTemplate>
</ig:TemplateDataField>
</Columns>
</stgwc:WebDataGrid>
新しいアイテムを作成する必要がある場合は、ポストバックを実行してから、データソースに設定してリロードします。次のようにします。
dgrIndRoleAttributes.ClearDataSource();
dgrIndRoleAttributes.Rows.Clear();
dgrIndRoleAttributes.DataSource = null;
dgrIndRoleAttributes.DataSource =
(Session[Constants.Session.RoleAttributes.ToString()] as List<TmpIndRoleAttribute>);
dgrIndRoleAttributes.DataBind();
ここで面白い部分があります: 新しい行を追加した後に Enter キーを押すと、Firefox (Firefox のみ、IE では正しく動作します) は、validator-group のバリデーターがattrib
適切に設定されていないと考えているようで、2 回クリックする必要があります。それは保存します。
これをfirebugで確認すると、両方のバリデータが表示されていることがわかります.noneなので、これは問題になりません。前述のように、これは Firefox でのみ発生し、小さなテストサンプルでは再現できません。
この動作の原因は何ですか? 私はこのバリデーターに慣れていないので、何がこの問題を引き起こすのか想像できません。
ご回答ありがとうございます。
マティアス
Edith のコメント: これはインフラジスティックスのバグです... もう 1 つ... この場合、通常の ASP テキスト ボックスを使用し、CSS でスタイルを変更します。