使用jquery和webservice编辑项内联客户端

时间:2015-09-15 20:42:40

标签: javascript c# jquery web-services webmethod

zoomScale

我想制作网络服务,我可以使用jquery和webservice更新客户端的价格。能够编辑内联价格(使用jquery和webservice进行客户端)

   <script>
        function validate() {
            var editName = document.getElementById('<%=txt_editName.ClientID %>').value;
            var editPrice = document.getElementById('<%=txt_editPrice.ClientID %>').value;
            if (editName == "") {
                alert("Enter  Name");
                return false;
            }
            if (editPrice == "" && editPrice.value != 0) {
                alert("Enter  Price");
                return false;
            }
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">


        <table class="auto-style1">
            <tr>
                <td>Name</td>
                <td>
                    <asp:TextBox ID="txt_serchName" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>Price</td>
                <td>
                    <asp:TextBox ID="txt_SearchPrice" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>
                    <asp:Button ID="btn_search" runat="server" Text="Search" OnClick="btn_search_Click" />
                </td>
            </tr>
        </table>
        <br />
        Add/Edit:<br />
        <table class="auto-style1">
            <tr>
                <td>Name</td>
                <td>
                    <asp:TextBox ID="txt_editName" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>Price</td>
                <td>
                    <asp:TextBox ID="txt_editPrice" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>
                    <asp:Button ID="btn_saveItems" OnClientClick="return validate()" runat="server" Text="Save" OnClick="Button1_Click" />
                    <br />
                    <asp:Label ID="lbl_success" runat="server"></asp:Label>
                </td>
            </tr>
        </table>


        <p>
            &nbsp;
        </p>

        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="id" OnRowCancelingEdit="GridView2_RowCancelingEdit" OnRowDeleting="GridView2_RowDeleting" OnRowEditing="GridView2_RowEditing" OnRowUpdating="GridView2_RowUpdating" CellPadding="4" ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="id" HeaderText="S.No." />
                <asp:BoundField DataField="name" HeaderText="Name" />
                <asp:BoundField DataField="price" HeaderText="price" />

                <asp:CommandField ShowEditButton="true" />
                <asp:CommandField ShowDeleteButton="true" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>

{     String conctiioon = ConfigurationManager.ConnectionStrings [“shopcart”]。ConnectionString;

    public partial class Items_Page : System.Web.UI.Page

}

0 个答案:

没有答案