View Single Post
  #24 (permalink)  
Old February 5th, 2015, 09:13 PM
projectx projectx is offline
Registered User
Points: 29, Level: 1
Points: 29, Level: 1 Points: 29, Level: 1 Points: 29, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2014
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

.aspx page with jquery and gridview, gridview at top, jquery at bottom
Code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Frontend.master" AutoEventWireup="true" CodeFile="Agents.aspx.cs" Inherits="agents_agents" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display." AllowPaging="True" AllowSorting="True">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="False" ButtonType="Button" ControlStyle-BorderStyle="None" HeaderStyle-BorderStyle="None" />
            <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID" Visible="False" />
            <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
            <asp:BoundField DataField="Commission" HeaderText="Commission" SortExpression="Commission" DataFormatString="{0:p0}" />
            <asp:BoundField DataField="HLBCommission" HeaderText="HLB Commission" SortExpression="HLBCommission" DataFormatString="{0:p0}" />
            <asp:BoundField DataField="Email" HeaderText="E-mail" SortExpression="Email" />
            <asp:BoundField DataField="Password" HeaderText="Password" SortExpression="Password" Visible="False" />
        </Columns>
    </asp:GridView>
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" DefaultMode="Insert" Height="50px" Width="125px">
        <Fields>
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
            <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
            <asp:BoundField DataField="Commission" HeaderText="Commission" SortExpression="Commission" />
            <asp:BoundField DataField="HLBCommission" HeaderText="HLB Commission" SortExpression="HLBCommission" />
            <asp:BoundField DataField="Email" HeaderText="E-mail" SortExpression="Email" />
            <asp:BoundField DataField="Password" HeaderText="Password" SortExpression="Password" />
            <asp:CommandField ShowInsertButton="True" />
        </Fields>
    </asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AssociatesCommToolConnectionString1 %>" DeleteCommand="DELETE FROM [Agent] WHERE [ID] = @ID" InsertCommand="INSERT INTO [Agent] ([FirstName], [LastName], [Commission], [HLBCommission], [Email], [Password]) VALUES (@FirstName, @LastName, @Commission, @HLBCommission, @Email, @Password)" ProviderName="<%$ ConnectionStrings:AssociatesCommToolConnectionString1.ProviderName %>" SelectCommand="SELECT [ID], [FirstName], [LastName], [Commission], [HLBCommission], [Email], [Password] FROM [Agent]" UpdateCommand="UPDATE [Agent] SET [FirstName] = @FirstName, [LastName] = @LastName, [Commission] = @Commission, [HLBCommission] = @HLBCommission, [Email] = @Email, [Password] = @Password WHERE [ID] = @ID">
    <DeleteParameters>
        <asp:Parameter Name="ID" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="FirstName" Type="String" />
        <asp:Parameter Name="LastName" Type="String" />
        <asp:Parameter Name="Commission" Type="Decimal" />
        <asp:Parameter Name="HLBCommission" Type="Decimal" />
        <asp:Parameter Name="Email" Type="String" />
        <asp:Parameter Name="Password" Type="String" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="FirstName" Type="String" />
        <asp:Parameter Name="LastName" Type="String" />
        <asp:Parameter Name="Commission" Type="Decimal" />
        <asp:Parameter Name="HLBCommission" Type="Decimal" />
        <asp:Parameter Name="Email" Type="String" />
        <asp:Parameter Name="Password" Type="String" />
        <asp:Parameter Name="ID" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>

    <script type="text/javascript">
        $(function ()
        {
            $('.GridView tr:odd:not(.GridViewPagerStyle').addClass('GridViewAlternatingRowStyle');
        });
    </script>
</asp:Content>
Reply With Quote