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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:36:50+00:00 2026-05-13T07:36:50+00:00

This is driving me crazy. I’m not including any code because I want to

  • 0

This is driving me crazy. I’m not including any code because I want to know the best approach to do this conceptually without influencing the answer.

In Asp.Net MVC 2 (beta 2010 incidently) I have a MasterPage Site.Master with a UserControl “SignIn”. This user control has 3 fields that I want to get data from. The TextBox value “Email”, the TextBox value “Password” and the bool CheckBox value “RememberMe”. Now I have tried a number of things but all of them relate to the action being passed to the HomePageController which has its own Model type which is not the same as the UserControl’s Model type. UserControl Model = User class, HomePageController Model = specialized HomePageData Model which has things I need to populate my HomePage View Content.

I can wire into the HomePageController Action “SignIn” both via ActionLink and a specific Post with parameters (string Email, string Password, bool? RememberMe) but no values of my HtmlHelper controls residing on the UserControl SignIn.ascx ever get passed into the conroller seemingly no matter what I try.

The SignIn control truly needs to reside on the Site.Master but I’m not sure I’m doing the right thing by using the HomePageController vs. setting up an “AccountController” but the point is moot unless I can somehow get the values entered by the user into the 3 input fields of the UserControl.

To note: I have tried UpdateModel (which does not throw an exception but all of the fields of the user object are null, TryUpdateModel with similar results, TryUpdateModel returns true but all null properties on the user instance, [AcceptVerbs[“Post”]] in a HomePageController method “SignIn” with and without parameters, again no values passed or able to be retrieved from the UserControl correctly. ad nauseam.)

I have scoured the internet and cannot find an example accomplishing exactly what I’m trying to do with the MasterPage->UserControl->XyzController scenario (again, I’m not insistent on using HomePageController for this so the proper way to do this may use a “viewless” controller.

Somebody give me a Merry Christmas (if anyone’s working lol)

Thanks in advance… oh and if you only know Vb.Net that’s fine as well, I’ll convert your answer to C#.

OK – I tried the suggestions below to no avail. I created a simple example (without the suggestions being used as a base to start from)

my MasterPage (Site.Master) is as follows…

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
    <% Html.RenderPartial("SignIn"); %>
    <asp:ContentPlaceHolder ID="MainContent" runat="server" />
</body>
</html>

and my SignIn UserControl is as follows

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<StackOverflowExample.Models.WebUser>" %>

Email: <%= Html.TextBox("Email") %>
Password: <%= Html.TextBox("Password") %>

<%= Html.ActionLink("Sign In", "SignIn", "Home") %>

…and my simplified Model is as follows ….

namespace StackOverflowExample.Models
{
    public class WebUser
    {
        public string Email { get; set; }
        public string Password { get; set; }
    }
}

… and my HomeController is as follows …

namespace StackOverflowExample.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult SignIn()
        {
            var user = new WebUser();

            try
            {
                UpdateModel(user);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                throw;
            }

            return Redirect("Index");
        }
    }
}

… from this simple example, if I can get data into the WebUser instance inside HomeController, or any other Controller for that matter I can use the posted example to fix my real-world website. I know I’m missing something very fundamental here and I’m 99% sure is has to do with the fact that the SignIn control is strongly-typed to the WebUser class but the HomeController or HomeView (Index.aspx) is not strongly typed to the same (or any other) Model.

Here’s the skimpy Index.aspx Home View (just in case anyone needs it …)

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
</asp:Content>
  • 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-05-13T07:36:50+00:00Added an answer on May 13, 2026 at 7:36 am

    in your control you are missing Html.BeginForm(“SignIn”)

    <% using (Html.BeginForm("SignIn","Home") [ %>
    Email: <%= Html.TextBox("Email") %>
    Password: <%= Html.TextBox("Password") %>
    
    <%= Html.ActionLink("Sign In", "SignIn", "Home") %>
    <% } %>
    

    and try to include a submit button first in that form.

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

Sidebar

Related Questions

This is driving me crazy , so any help would be awesome: My html
This is driving us crazy... In VS2010, MVC2 projects, not all projects.... both on
OK, this is driving me crazy now, I already messed with all my code
This is driving me crazy i know its a simple error but either i
So this is driving me crazy. Basically, when I hard-code my user name and
This is driving me crazy. I want to show in a QWebPage an url,
This is driving me crazy - why doesn't my code work? <a id=send-thoughts href=>Click</a>
This is driving me crazy - basically this if statement is not working. The
This is driving me crazy and I can't find any good resources to explain
This is driving me crazy. I'm not going to take it anymore. I'm going

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.