티스토리 뷰

💼 정보 ver1.0

submit 이벤트 가로채기

James Wetzel 2013. 6. 8. 13:22

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<List<EmptyMvcApplication.Models.Entity.MountainInfo>>" %>


<!DOCTYPE html>


<html>

<head runat="server">

    <meta name="viewport" content="width=device-width" />

    <script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(document).ready(function () {           

            $("#summits form[action$='/ZebraDelete']").submit(function () {

                var itemText = $("input[name=itemName]", this).val();

                return confirm("["+itemText+"] 을 정말로 삭제할까요?");

            });

        });

    </script>

    <style type="text/css">

        table, table td { padding: 30px; border-spacing: 0;}            

    </style> 

    <title>Zebra</title>

</head>

<body>

    <div id="summits">

        <table>

            <thead>

                <tr>

                    <td>Item</td>

                    <td>Height</td>

                    <td>Actions</td>

                </tr>

            </thead>

            <% foreach (var item in Model) 

                {

            %>

                <tr>

                    <td><%: item.Name %></td>

                    <td><%: item.HeightinMeters %></td>

                    <td>

                        <% using (Html.BeginForm("ZebraDelete", "AjaxSample", FormMethod.Post))

                           { %>

                        <%: Html.Hidden("itemID", item.No)%>

                        <%: Html.Hidden("itemName", item.Name) %>

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

                        <% } %>

                    </td>

                </tr>                    

            <%       

                } 

            %>            

        </table>        

    </div>

</body>

</html>



반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함