DetailsView不会将某些字段传递给DetailsViewUpdatedEventArgs和DetailsViewInsertedEventArgs

时间:2015-07-29 21:51:57

标签: asp.net webforms detailsview

我有一些使用asp:TemplateField的字段。用户名和密码的代码示例如下 -

<asp:TemplateField HeaderText="User Name" SortExpression="User_Name">
    <EditItemTemplate>
        <ISEP:PFTextBox ID="User_NameControl" runat="server" Text='<%# Bind("User_Name") %>'
            CssClass="DetView TextBox DataWindowControl" /> 
        <asp:Label runat="server" ID ="User_NameRequiredStar" Text="*" CssClass="DetView Label DataWindowControl" ForeColor="Red" style="display: none;"/>
        <asp:CustomValidator id="CustomValidatorUserNameExisting" ControlToValidate="User_NameControl" ClientValidationFunction="UserNameExistingValidate"
                   Display="Static" ErrorMessage="User Name already exists. Please enter a different user name." ForeColor="red" runat="server"  Enabled="false"/>
        <asp:RequiredFieldValidator
            ID="User_NameControlRequiredFieldValidator" runat="server" ControlToValidate="User_NameControl"
            ErrorMessage="<%$ AppSettings: RequiredErrorMessage %>" Enabled="false"></asp:RequiredFieldValidator> 
        <asp:RegularExpressionValidator ID="User_NameMaxLengthValidator" runat="server"
            ErrorMessage="<%$ AppSettings: MaxLengthErrorMessage %>" ValidationExpression="^(.|\n){0,80}$" ControlToValidate="User_NameControl"></asp:RegularExpressionValidator>
    </EditItemTemplate>
    <InsertItemTemplate>
        <ISEP:PFTextBox ID="User_NameControl" runat="server" Text='<%# Bind("User_Name") %>'
            CssClass="DetView TextBox DataWindowControl" />
        <asp:Label runat="server" ID ="User_NameRequiredStar" Text="*" CssClass="DetView Label DataWindowControl" ForeColor="Red" style="display: none;"/>
        <asp:CustomValidator id="CustomValidatorUserNameExisting" ControlToValidate="User_NameControl" ClientValidationFunction="UserNameExistingValidate"
                   Display="Static" ErrorMessage="User Name already exists. Please enter a different user name." ForeColor="red" runat="server"  Enabled="false"/>
        <asp:RequiredFieldValidator
            ID="User_NameControlRequiredFieldValidator" runat="server" ControlToValidate="User_NameControl"
            ErrorMessage="<%$ AppSettings: RequiredErrorMessage %>" Enabled="false"></asp:RequiredFieldValidator> 
        <asp:RegularExpressionValidator ID="User_NameMaxLengthValidator" runat="server"
            ErrorMessage="<%$ AppSettings: MaxLengthErrorMessage %>" ValidationExpression="^(.|\n){0,80}$" ControlToValidate="User_NameControl"></asp:RegularExpressionValidator>
    </InsertItemTemplate>
    <ItemTemplate>
        <ISEP:PFLabel ID="User_NameLabel" runat="server" Text='<%# Bind("User_Name") %>'
            CssClass="DetViewText Label DataWindowControl" />
    </ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Password" SortExpression="User_Password">
    <EditItemTemplate>
        <ISEP:PFTextBox ID="User_PasswordControl" TextMode="Password" runat="server" Text='<%# Bind("User_Password") %>'
            CssClass="DetView TextBox DataWindowControl" />
        <asp:Label runat="server" ID ="User_PasswordRequiredStar" Text="*" CssClass="DetView Label DataWindowControl" ForeColor="Red" style="display: none;"/>
        <asp:RequiredFieldValidator
            ID="User_PasswordControlRequiredFieldValidator" runat="server" ControlToValidate="User_PasswordControl"
            ErrorMessage="<%$ AppSettings: RequiredErrorMessage %>" Enabled="false"></asp:RequiredFieldValidator> 
        <asp:RegularExpressionValidator ID="User_PasswordMaxLengthValidator" runat="server"
            ErrorMessage="<%$ AppSettings: MaxLengthErrorMessage %>" ValidationExpression="^(.|\n){0,80}$" ControlToValidate="User_PasswordControl"></asp:RegularExpressionValidator>
    </EditItemTemplate>
    <InsertItemTemplate>
        <ISEP:PFTextBox ID="User_PasswordControl" TextMode="Password" runat="server" Text='<%# Bind("User_Password") %>'
            CssClass="DetView TextBox DataWindowControl" />
        <asp:Label runat="server" ID ="User_PasswordRequiredStar" Text="*" CssClass="DetView Label DataWindowControl" ForeColor="Red" style="display: none;"/>
        <asp:RequiredFieldValidator
            ID="User_PasswordControlRequiredFieldValidator" runat="server" ControlToValidate="User_PasswordControl"
            ErrorMessage="<%$ AppSettings: RequiredErrorMessage %>" Enabled="false"></asp:RequiredFieldValidator> 
        <asp:RegularExpressionValidator ID="User_PasswordMaxLengthValidator" runat="server"
            ErrorMessage="<%$ AppSettings: MaxLengthErrorMessage %>80" ValidationExpression="^(.|\n){0,80}$" ControlToValidate="User_PasswordControl"></asp:RegularExpressionValidator>
    </InsertItemTemplate>
</asp:TemplateField>

我不知道为什么User_Name被传递给DetailsViewUpdatedEventArgs和DetailsViewInsertedEventArgs,但User_Password不是。

除OnItemUpdated和OnItemInserted外,我在哪里可以调试这些字段?

谢谢,

0 个答案:

没有答案