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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:17:52+00:00 2026-05-25T02:17:52+00:00

I have class public class Class2 { public string myName { get; set; }

  • 0

I have class

public class Class2
{
    public string myName { get; set; }
    public string phone { get; set; }
    public jInformation jf { get; set; }
    public Class2()
    {

    }
}

public class jInformation
{
    public string name { get; set; }
    public string display { get; set; }
    public jInformation()
    {

    }
}

Now my action method is

public ActionResult Test()
    {
        Class2 oClass = new Class2();
        return View("ViewPage1",oClass);
    }

And post is

[AcceptVerbs(HttpVerbs.Post)]
    [ValidateInput(false)]
    public void Test(Class2 oClass)
    {
        String sTemp = oClass.myName;
        String sp = oClass.phone;
    }

I want to create a stongley typed view with ViewContent As “Edit”. So when i create strongly typed view, it just create text box for myName and phone property. How can i create textbox for jINformation class? I am using MVC1 and newbie to MVC world…….

My CustomModel Binder looks like

  public class Class2ModelBinder : IModelBinder
{
    public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
    {
        var request = controllerContext.HttpContext.Request;

        return new Class2()
                   {
                       myName = request.Form.Get("myName"),
                       phone = request.Form.Get("phone"),
                       jf = new jInformation { name = request.Form.Get("name"), display = request.Form.Get("display") }
                   };
    }
}

I registered it with application_start. Now question is, what i should pass on get and post method?

  • 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-25T02:17:53+00:00Added an answer on May 25, 2026 at 2:17 am

    My previous comment was a bit wrong. The default Model Binder will work for your ‘Class2’.

    Here i tested and it works.

    The Controller code

    public class TestController : Controller
    {       
        public ActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public ActionResult IndexPost()
        {
            Class2 cls = new Class2();
            UpdateModel(cls);
            return View(cls);
        }
    }
    

    The view code (Just a form against your Model)

    <%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<Class2>" %>
    <h2>Index</h2>
    <% using (Html.BeginForm("indexpost","test")) {%>
    <%: Html.TextBox("myName") %>
    <%: Html.TextBox("phone")%>
    <%: Html.TextBox("jf.name")%>
    <%: Html.TextBox("jf.display")%>
    
    
    <input type="Submit" value="submit" />
    <%} %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this class called Table: class Table { public string Name { get
I have a class: public class Car { public string Model {get;set;} public string
I have a class public class Person { public string FirstName { get; set;
Suppose I have a class public class MyClass { private Set<String> set = new
I have the following class: public abstract class AbstractParent { static String method() {
I have the following classes: public class Person { public String FirstName { set;
Let's say I have a class: class Foo { public string Bar { get
For example, suppose I have a class: class Foo { public: std::string& Name() {
If I have the following code: public class MyClass { public string myName {
So, I have this class: public class Product { private String name, id, info

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.