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 8429237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:16:47+00:00 2026-06-10T05:16:47+00:00

I have a custom Membership for my app, and it’s pretty much the same

  • 0

I have a custom Membership for my app, and it’s pretty much the same as the generic one. Among other details what’s different is how I pass values to my Register post method.

Until now I had username, password, firstName, …, state, all as strings (there’s more but irrelevant for the question) in my method parameters, like so:

public ActionResult Register(string userName, string password, string confirmPassword, string firstName, string lastName, string address, string city, string state, string zip)

The issue at hand is State parameter, now I want it to be passed from a dropdown not from a textbox as it was so far.

I’ve made a model for dropdown to be populated.

public class State
{
    public int StateID { get; set; }
    public string StateName { get; set; }
}

And added appropriate SelectList in my Register View method.

public ActionResult Register()
{
    ViewBag.StateID = new SelectList(db.States, "StateID", "StateName");
    ViewData["PasswordLength"] = MembershipService.MinPasswordLength;

    return View();
}

Then I’ve altered the Register View, and made a dropdown instead of Html.TextBoxFor helper.

@Html.DropDownList("StateID", (SelectList)ViewBag.StateID, new { @class = "ddl" })

Note that, all these parameters excluding username and password, are saved in User Profile properties. This is how that’s done in Register post method.

ProfileBase _userProfile = ProfileBase.Create(userName);

_userProfile.SetPropertyValue("FirstName", firstName);
_userProfile.SetPropertyValue("LastName", lastName);
_userProfile.SetPropertyValue("Address", address);
_userProfile.SetPropertyValue("City", city);
_userProfile.SetPropertyValue("State", state);
_userProfile.SetPropertyValue("Zip", zip);

_userProfile.Save();

Lastly, the problem is that it doesn’t get saved. The State property for that users Profile is empty.

I’ve tried several more ideas but nothing so far.

  • 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-10T05:16:48+00:00Added an answer on June 10, 2026 at 5:16 am

    The dropdown should have the same name as the parameter you want it to map to. It looks like it’s id is “StateID”, but it should read “state” (as the name of the parameter).

    So it should read:

    @Html.DropDownList("State", (SelectList)ViewBag.StateID, new { @class = "ddl" }) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC app with custom membership and role providers. I am checking
I have an MVC3 app using Autofac and a custom membership provider. If I
We have created a custom membership provider that we are using in one of
I use declarative roles in my MVC.NET controllers and I have a custom membership
I have built a custom membership provider that I have used in a previous
I am creating custom membership provider for my asp.net application. I have also created
I have custom classes that I currently instantiate within App.xaml as resources. I want
I am developing an ASP.NET MVC app with custom membership and role providers. My
I have a simple create user wizard and custom membership provider which was taken
I have an ASP.NET MVC web application that implements a custom membership provider. The

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.