0

I have a few fields using asp:TemplateField. The code sample for user name and password is below -

<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>

I do not why User_Name is passed to DetailsViewUpdatedEventArgs and DetailsViewInsertedEventArgs but User_Password is not.

Except for OnItemUpdated and OnItemInserted, where can I debug these fields?

Thanks,

Don
  • 1,532
  • 4
  • 24
  • 47
  • possible duplicate of [Textbox using textmode password not showing text asp.net c#](http://stackoverflow.com/questions/16739473/textbox-using-textmode-password-not-showing-text-asp-net-c-sharp) – Dhaust Jul 29 '15 at 22:03
  • @DavidHAust Thanks. But it is not the same case as the link you post here. I remove the code - TextMode="Password". The e.NewValues["User_Password"] is still null but e.NewValues["User_Name"] is not. – Don Jul 29 '15 at 22:18
  • No problem. It was worth checking if that was the problem. – Dhaust Jul 29 '15 at 23:24

0 Answers0