how can i use properties in 2 @using (html.beginform ) in my view RRS feed

  • Question

  • User1928394251 posted

    in my view 2 @using (Html.BeginForm)) with 2 different action method in different controller  that have diffrent properties(attributes) .

    how can i use properties(attributes)  in new controller or new view or new table ?

    what do i . i  need to properties(attributes)  in 2  form .

    thank you

    Tuesday, January 1, 2019 8:27 AM

All replies

  • User1120430333 posted

    You need to show some code as to what you are talking about to enplane things. You can use the {;} icon on the toolbar  to format the code before posting it.

    Tuesday, January 1, 2019 9:48 AM
  • User1928394251 posted

    @using (Html.BeginForm("index3", "afishstudio", FormMethod.Post, null))

    @Html.TextBoxFor(Model => Model.id, new { @class = "flat" })
    @Html.TextBoxFor(Model => Model.name, new { @class = "flat" })


    @using (Html.BeginForm("index5", "modiran", FormMethod.Post, null))

    <input type="hidden" value="id" />
    <input type="text" name="modiran_name" asp-for="input.modiran_name" />
    <input type="radio" name="modiran_semat" value="modirkol" asp-for="input.modiran_semat" />


    how to use properties(atributes) in 2 form for send to another view or save in new table ....

    Tuesday, January 1, 2019 10:09 AM
  • User1120430333 posted

    Maybe, you're looking for partial view fuctionality.


    Just a little FYI, do you see the difference in my code post as opposed to yours, which is formatted? This is due to I used the {;} icon up on the posting toolbar that formats any code you are wanting to put into a post, look up there on the toolbar for the icon.


        ViewBag.Title = "Home Page";
    <div class="jumbotron">
        <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
        <p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p>
    <div class="row">
        <div class="col-md-4">
            <h2>Getting started</h2>
                ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
                enables a clean separation of concerns and gives you full control over markup
                for enjoyable, agile development.
            <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p>
        <div class="col-md-4">
            <h2>Get more libraries</h2>
            <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
            <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p>
        <div class="col-md-4">
            <h2>Web Hosting</h2>
            <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
            <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p>
    @Html.ActionLink("List of students", "Index", "Students")<br />
    @Html.ActionLink("List of enrollments", "Index", "Enrollments")

    Tuesday, January 1, 2019 1:18 PM
  • User475983607 posted

    how to use properties(atributes) in 2 form for send to another view or save in new table ....

    The biggest issues is there are no submit buttons in the HTML forms.   Browsers submit the inputs within a single HTML form.   Having two forms with no submit buttons usually indicates the forms are submitted by JavaScript but there's not JavaScript shown. 

    This post is similar to your others where the code makes little sense.  In previous posts I recommended going through the Getting Started tutorials to learn the basics but it seems that you are not following this advice or at least not reflected in your code.

    Can you explain the problem you are trying to solve?  Is there anyway you can post enough code to reproduce the stated issue? 

    Tuesday, January 1, 2019 2:25 PM
  • User1520731567 posted

    Hi aabedeni056,

    According to your code,you have two forms without submit button.

    <input type="submit" value="Submit"/>

    Here is the example about how to submit form in mvc,you could refer to it:


    In addion,you have 2 forms and 2 actions,this means users need to click submit button twice to submit all information.

    If you want to simplify the steps, I suggest you can merge two forms.

    Best Regards.

    Yuki Tao

    Wednesday, January 2, 2019 6:56 AM