Multiple buttons in the table do not require the implementation of the jump page

Source: Internet
Author: User

One common requirement is to have multiple operations on a single record in a table and plan to manipulate the database in an AJAX asynchronous manner.

Main view

<td>
<div class= "Btn-group btn-group-sm" >
<a href= "@Url. Action (" Detailsadmin "," Applicationproject ", new {id = Item.) Applicationprojectid}) "class=" btn btn-primary "role=" button "> View project Contents </a>
<button type= "button" class= "btn btn-primary dropdown-toggle" data-toggle= "dropdown" >
<span class= "Caret" ></span>
<span class= "Sr-only" > Toggle drop-down menu </span>
</button>
<ul class= "Dropdown-menu" role= "Menu" >
<li> <a href= "@Url. Action (" Editadmin "," Applicationproject ", new {id = Item). Applicationprojectid}) "> Edit </a></li>
<li> <a href= "Javascript:deleteapplicationproject (' @item. Applicationprojectid ') > Delete </a></li>
<li> <a href= "Javascript:updateapplicationproject (' @item. Applicationprojectid ', ' Submitsingle ') "> Submit </a></li>
<li> <a href= "Javascript:updateapplicationproject (' @item. Applicationprojectid ', ' Submitnotsingle ') "> Cancel Submit </a></li>
<li> <a href= "Javascript:updateapplicationproject (' @item. Applicationprojectid ', ' Checkpasssingle ') "> First trial through </a></li>
<li> <a href= "Javascript:updateapplicationproject (' @item. Applicationprojectid ', ' Checknotpasssingle ') "> first trial not through </a></li>
</ul>

</div>
</td>

@* creates a hidden form that responds to a number of different actions and commits to different controllers *@
<form id= "Applicationprojectform" method= "POST" ><input type= "hidden" name= "id" id= "applicationprojectid"/ ></form>

2. Script files

<script type= "Text/javascript" > @* defining a cshtml file is more useful than defining a single JS file. Actually in JS inside can also use URL, HTML helper method. *@
//_reviewprojectid = $ ("Reviewprojectid"). Val ();
function Updateapplicationproject (ID, Action,reviewprojectid) {
$ ("#applicationProjectId"). Val (id);
var Choice = Confirm ("Are you sure you want to proceed?" ");
if (choice = = True)
{
Switch (action) {
case ' Submitsingle ':
$ ("#applicationProjectForm"). attr (' Acti On ', ' @Url. Action ("Makeasubmit"). Submit ();
break;
Case ' Submitnotsingle ':
$ ("#applicationProjectForm"). attr (' action ', ' @Url. Action ("Makeanotsubmit"). Submit ();
break;
Case ' Checkpasssingle ':
$ ("#applicationProjectForm"). attr (' action ', ' @Url. Action ("Makeapasscheck"). Submit ();
break;
Case ' Checknotpasssingle ':
$ ("#applicationProjectForm"). attr (' action ', ' @Url. Action ("Makeanotpasscheck") ' ). submit ();
break;
Default:
Console.debug (' Unknown action ' + action);//For browser debugging, pressing the F12 key displays the information in the Browser console window.
}

}

}

Multiple buttons in the table do not require the implementation of the jump page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.