Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8779139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:42:36+00:00 2026-06-13T19:42:36+00:00

Essentially I have a HtmlPasswordFor(m => EmployeeID), I have a button called Go. Once

  • 0

Essentially I have a HtmlPasswordFor(m => EmployeeID), I have a button called “Go”. Once I hit the Go textbox, I actually do not want the password to disappear on the or have the field password to be cleared.
How would I do this?

BEFORE
enter image description here

AFTER
enter image description here
I do not want the my employeeid to reset. I want to keep the passwords in ****’s, but I’ll need the password on my next post call.

Controller

    [HttpGet]
    public ActionResult MainForm()
    {
        var model = new VTViewModel();
        return View(model);
    }

    [HttpPost]
    public ActionResult MainForm(VTViewModel model, string buttontype)
    {
        if (ModelState.IsValid)
        {
            string EmployeeID = (Convert.ToInt64(model.EmployeeBinaryID, 2)).ToString();
            if (buttontype == "Go")
            {
                // GET Fields depending on the serial number.

                model.ListFields = logic_model.getFormInfo(model.SerialNumber, EmployeeID);
                if (model.ListFields[0].return_num == "0")
                {
                    model.Go = true;
                    // Set Process
                    // Set Header Token
                    // Set Header Title

                    ViewData["HEADER"] = model.ListFields[0].HeaderName + " | " + model.ListFields[0].TubeType + " | " + model.ListFields[0].ProductLine;
                }
                else
                {
                    model.DisplayMessage = helper.checkErrors(model.ListFields[0].return_num);
                }
            }
            else if (buttontype == "Submit")
            {
                model.HeaderToken = model.ListFields[0].HeaderToken; 
                string header = model.HeaderToken;
                string check = "";                                                        
                string return_num = model.ListFields[0].return_num; 
                // If the submission worked

                //SUBMIT HERE INTO DB then Clear
                List<string> values_to_submit = new List<string>(); // Creates a list to store the values to submit
                for (int i = 0; i < model.ListFields.Count; i++)
                {
                    // Fills in the hidden values.
                    if (model.ListFields[i].isHidden)
                    {
                        if (model.ListFields[i].Token == "SNT" || model.ListFields[i].Token == "SNC")
                        {
                            model.ListFields[i].Value = model.SerialNumber;
                        }
                        else if (model.ListFields[i].Token == "USR")
                        {
                            model.ListFields[i].Value = EmployeeID;
                        }
                        else if (model.ListFields[i].Token == "TMS")
                        {
                            model.ListFields[i].Value = "0";
                        }
                    }

                    // If it is a check box do the right conversion.
                    if (model.ListFields[i].DataType == "DATA-CKBOX")
                    {
                        //string convertedValue = helper.trueFalseStringtToIntBool(model.ListFields[i].Value);
                        string convertedValue = helper.boolToInt(model.ListFields[i].BoolValue).ToString();
                        model.ListFields[i].Value = convertedValue;
                    }

                    values_to_submit.Add(model.ListFields[i].Token + model.ListFields[i].Value);

                }

                check = logic_model.helperSubmit(values_to_submit, header, 1);



                if (check == "Submitted")
                {
                    ModelState.Clear();
                    VTViewModel clear_model = new VTViewModel(); // Creates an empty model
                    clear_model.DisplayMessage = "Submitted\n" + model.SerialNumber + "\n" + DateTime.Now;
                    return View(clear_model);
                }
                else
                {
                    model.DisplayMessage = check; // Sets the display message to the error.
                }

            }
            else if (buttontype == "Clear")
            {
                // Clears the screen and model
                ModelState.Clear();
                VTViewModel clear_model = new VTViewModel(); // Creates an empty model
                return View(clear_model);
            }
        }
        return View(model);

    }

View

    div>
         <fieldset>
         <table id="main_table">
                <tr>
                    <td>@Html.LabelFor(m => m.SerialNumber)</td>
                    <td>@Html.LabelFor(m => m.EmployeeBinaryID)</td>
                </tr>
                <tr>
                    <td>@Html.TextBoxFor(m => m.SerialNumber)</td>
                    <td>@Html.PasswordFor(m => m.EmployeeBinaryID, new { autocomplete = "off" }) </td>
                </tr>

                <tr><td><input type="submit" value="Go" name="buttontype" class="submit_button" id="btn"/><br /><br /></td></tr>
         </table>
         </fieldset>
         <br /> 

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:42:37+00:00Added an answer on June 13, 2026 at 7:42 pm

    Html.PasswordFor will never render the value, probably for security reasons. You can work around this, but you have to use Html.EditorFor instead, decorate the EmployeeID property with [DataType(DataType.Password)] and add the following editor template at ~/Views/Shared/EditorTemplates/Password.cshtml

    @Html.Password("", ViewData.TemplateInfo.FormattedModelValue, new { @class = "text-box single-line password" })
    

    You could also use [UIHint] and create a template for that particular property only.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Essentially I have a method of a class called killProgram, which is intended to
So, I essentially have what I want already, very simple, but there are some
So I am not sure if my title is clear enough. I essentially have
Essentially I have an NSMutableArray which contains several NSDictionaries . I wish to sort
Essentially I have a script which acts as a task wrapper and emails a
I have essentially the same problem discussed here: http://khason.net/blog/dependency-property-getters-and-setters-in-multithreaded-environment/ public static readonly DependencyProperty MyPropertyProperty
I'm trying to build a Hibernate layer for a database schema I have essentially
First i was wondering if this is a good idea, essentially i have user
I have two essentially separate applications for configuring two pieces of hardware sold by
I have a class essentially: public class WindowEvent extends Event { public static const

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.