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

  • Home
  • SEARCH
  • 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 5843611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:10:42+00:00 2026-05-22T12:10:42+00:00

I have this Model: public class Package { public string CustomerName { get; set;

  • 0

I have this Model:

public class Package
{
    public string CustomerName { get; set; }
    public List<Product> Products { get; set; }
}

public class Product
{
    public int Quantity { get; set; }
    public string Name { get; set; }
}

When I add the Create’s view, the code is:

    <fieldset>
        <legend>Fields</legend>

        <div class="editor-label">
            <%: Html.LabelFor(model => model.CustomerName) %>
        </div>
        <div class="editor-field">
            <%: Html.TextBoxFor(model => model.CustomerName) %>
            <%: Html.ValidationMessageFor(model => model.CustomerName) %>
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>

How manage the Products list?
Can I get a button or something to create a new product and add it to the Products list?

Thank you

  • 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-22T12:10:43+00:00Added an answer on May 22, 2026 at 12:10 pm

    for creating buttn you can also do this use HTML.ActionLink() or Ajax.ActionLink() defined as a button like:

    <% Response.Write(Html.ActionLink("Add Product", "Create", new { id = tId, tNum = tNum }, new { @class = "oldVal" })); %>
    

    it’ll create a button on your page, and here you can see different attributes (so just check them out you’ll find it useful) … and from both of this which to use is more depends upon your desired action …

    and in your controller:

    public ActionResult Create() 
    {
        // do same as mentioned by [gnome][1]
    }
    

    here is the example: modal popup, declared as a partial view of page
    [partial view using Ajax.ActionLink()]

    using (Ajax.BeginForm("Login", "Users", null, new AjaxOptions() { UpdateTargetId = "divLoginPopupContent" }))
                {
                    Response.Write(Html.ValidationSummary(true));
        %>
                    <ul class="chooseQuestion">
                        <li>
                            <div class="short">
                                <%= Html.LabelFor(model => model.LoginEmail)%>
                            </div>
                            <div class="editor-field">
                                <%= Html.TextBoxFor(model => model.LoginEmail)%>
                                <%= Html.ValidationMessageFor(model => model.LoginEmail)%>
                            </div>
                        </li><li>
                            <div class="short">
                                <%= Html.LabelFor(model => model.LoginPassword)%>
                            </div>
                            <div class="editor-field">
                                <%= Html.PasswordFor(model => model.LoginPassword)%>
                                <%= Html.ValidationMessageFor(model => model.LoginPassword)%>
                            </div>
                        </li><li>
                            <div class="checkbox">                
                                <%= Html.CheckBoxFor(model => model.Remember)%>
                                <%= Html.LabelFor(model => model.Remember)%>
                            </div>
                        </li><li>
                            <input type="submit" class="button" value="Login" id="btnLoginSubmit" />
                            <div id="divlogin_ajaxloading" style="display:none; vertical-align:top; text-align:center;"><img alt="" src="/images/ajax-loader.gif" /></div>
                        </li>
                    </ul> 
                }
    

    your partial view action:

    public ActionResult Login(LoginModel model)
            {
                if (ModelState.IsValid)
                {
                    if (Membership.ValidateUser(model.LoginEmail, model.LoginPassword))
                    {
                        return Redirect("/MyPage");
                    }
                    else
                    {
                        ModelState.Clear();
                        return PartialView("LoginPopup", new LoginModel());
                    }
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this model: public class Package { public string CustomerName { get; set;
I have this Model public class SalesModelView { [Key] public int SaleId { get;
i have this model on mvc: public class User { public string Name {
I have a class like this: class MyClass{ public: MyClass(int Mode); private: std::map <
I have the following classes: package models; public class Test extends activejdbc.Model { }
I have the following Model class: package com.swaranga.model; public final class Book { private
I'm using FluentNHibernate but NHibernate XML will do. Say I have this model public
i have this in my BlogRepository public IQueryable<Subnus.MVC.Data.Model.Post> GetPosts() { var query = from
Let's say I have this model named Product with a field named brand .
I have this Task model: class Task < ActiveRecord::Base acts_as_tree :order => 'sort_order' end

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.