简化版,的ValidationSummary显示错误 [英] ValidationSummary does't show Errors

查看:97
本文介绍了简化版,的ValidationSummary显示错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的GridView的一个问题,将不会显示在ValidationSummary-错误了。在ValidationSummary的HEADERTEXT并显示以及我设定出现在*每当防爆pressionValidation火灾。

I have a problem with my gridview which won't show the ValidationSummary-errors anymore. The Headertext of the ValidationSummary does show up as well as the * which I set to appear whenever the ExpressionValidation fires.

我敢肯定它之前的工作,但我不知道为什么它没有了。起初我以为它可能有一些做的,因为我有一个像5个不同的GridView不同TabPanels页面上的其他GridView的,但我已经制成每GridView控件1的ValidationGroup。

I'm quite sure it worked before, but I don't know why it doesn't anymore. At first I thought it might have something to do with the other GridViews on the page as I have like 5 different GridView in different TabPanels, but I already made one validationgroup per GridView.

标记:

<asp:UpdatePanel runat="server" UpdateMode="Always">
    <ContentTemplate>
       <asp:GridView ID="gvBBG" runat="server" AutoGenerateColumns="false" DataKeyNames="ID" SkinID="gvWithoutWidth">
         <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                   <asp:ImageButton runat="server" ImageUrl="~/Images/GridView/gv_edit.png" CommandName="Edit"/>
                </ItemTemplate>
                <EditItemTemplate>
                   <asp:ImageButton runat="server" ImageUrl="~/Images/GridView/gv_cancel.png" CommandName="Cancel" CausesValidation="false"/>
                   <asp:ImageButton Id="ibUpdate" runat="server" ImageUrl="~/Images/GridView/gv_update.png" CommandName="Update"  CausesValidation="true"
                        ValidationGroup="UpdateBBG" Enabled="true" OnClientClick="return confirm('Datensatz einspielen/aktualisieren?')"/>
                </EditItemTemplate>
           </asp:TemplateField>
           <asp:TemplateField HeaderText="KV West" HeaderStyle-HorizontalAlign="Left">
               <EditItemTemplate>
                    <asp:TextBox ID="tbKVWest" runat="server" Text='<%# Bind("KVWestFormatted") %>' ValidationGroup="UpdateBBG" Width="50px" Height="15px"></asp:TextBox>
                     <asp:RequiredFieldValidator ID="rfvKVWest" ValidationGroup="UpdateBBG" runat="server"
                           ControlToValidate="tbKVWest" ErrorMessage="Bitte KVWest als Summe angeben"
                           SetFocusOnError="true">*</asp:RequiredFieldValidator> 
                      <asp:RegularExpressionValidator ID="revKVWest" ValidationGroup="UpdateBBG" runat="server"
                           ValidationExpression="^[0-9]{1,9}((\,)[0-9]{1,2})?$" ControlToValidate="tbKVWest" SetFocusOnError="true">*</asp:RegularExpressionValidator>
              </EditItemTemplate>
              <ItemTemplate>
                  <%# Eval("KVWestFormatted")%>
              </ItemTemplate>
        </asp:TemplateField>
....
      </Columns>
          <EmptyDataTemplate>Keine Daten vorhanden</EmptyDataTemplate>
  </asp:GridView>
      <p>
            <asp:ValidationSummary ID="vsUpdate3" runat="server" ShowMessageBox="true" ShowSummary="true" ValidationGroup="UpdateBBG" Font-Bold="true" ForeColor="Red" 
                 EnableClientScript="true" Enabled="true" HeaderText="Validierung..." />
      </p>

将是很好,如果你们能帮助我在这里。我不是很确定是什么问题..也许这是在UpdatePanel?也许我做了一些愚蠢的错误..?我相当无能。

Would be nice if you guys could help me out here. Im not quite sure what the problem is .. maybe it's the UpdatePanel? Maybe I made some dumb mistake ..? I'm rather clueless.

推荐答案

发现问题。我必须设置为的RequiredFieldValidator和RegularEx pressionValidator的errormessage的。 ;)你不需要的文本框BTW内的的ValidationGroup

Found The problem .. I have to set the errormessage for both RequiredFieldValidator and RegularExpressionValidator. ;) You don't need the validationgroup inside of the textbox btw.

这篇关于简化版,的ValidationSummary显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆