Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
hi,I'm developing a web project in Mvc 4.I have a problem which drivez me crazy .

I generated automated Ef Controllers so the views.The Problem is I need to input a form in details.aspx which was generated automatically .In this automatically generated view page when I insert a simple Html Form such as:

XML
<form action="/mydata/createx" method="post">


    <fieldset>
        <legend>yorum</legend>


        Enter Your Comment<br />


        <textarea id="TextArea1" cols="20" rows="2" name="yorumicerik" ></textarea><br />


            <input type="submit" name="Post" />

    </fieldset>
    </form>


It does no action and posting back to page itself.

when I looked at the source code of this detail.aspx I come across such a crap:

XML
<form method="post" action="7" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE5ODYxNTE1MjIPZBYCZg9kFgICAw9kFgJmDw8WAh4LXyFEYXRhQm91bmRnZGRkb8RYMOq7pqebRBzpJ7VukpsweU4PIj77dptlTxSVaSY=" />
</div>



here the page posts to id parameter of the related model.How can I change the action url in here ? I mean I wanna insert "yorum/createx" instead of 7 here.

Thx for the replies.

The interesting point is, the form works in other views such as create,delete,edit but only in details view it doesnt work :D
Posted
Updated 27-Jul-13 10:34am
v3

1 solution

Any I Solved the problem by defining a method named same as Details and putting [HttpPost,ActionName("Details")] before the method. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900