Click here to Skip to main content
14,668,640 members
Rate this:
Please Sign up or sign in to vote.
See more:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Page2.aspx.cs" Inherits="WebApplication1.Page2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 270px;
        }
        .style3
        {
            width: 270px;
            text-align: right;
        }
        .style4
        {
            width: 223px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <script language="javascript" type="text/javascript">
//        function welcome() {
//            var name = document.getElementById("TextBoxName").value;
//            alert('Welcome to J Script :' + name);
//        }
    </script>
    <table class="style1">
        <tr>
            <td class="style3">
                Name :</td>
            <td class="style4">
                <asp:TextBox ID="TextBoxName" runat="server"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style3">
                City:</td>
            <td class="style4">
                <asp:TextBox ID="TextBoxCity" runat="server"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style3">
                State :</td>
            <td class="style4">
                <asp:TextBox ID="TextBoxState" runat="server"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style3">
                Phone no.</td>
            <td class="style4">
                <asp:TextBox ID="TextBoxPhone" runat="server"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style3">
                Salary :</td>
            <td class="style4">
                <asp:TextBox ID="TextBoxSalary" runat="server"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style3">
                Age:</td>
            <td class="style4">
                <asp:TextBox ID="TextBoxAge" runat="server" style="margin-bottom: 0px"

                    MaxLength="2"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style3">
                Gender :</td>
            <td class="style4">
                <asp:DropDownList ID="DropDownListGender" runat="server" Height="28px"

                    Width="125px">
                    <asp:ListItem></asp:ListItem>
                    <asp:ListItem>Male</asp:ListItem>
                    <asp:ListItem>Female</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td class="style4">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td class="style4">
                <asp:Button ID="ButtonSubmit" runat="server"

                   onclick="ButtonSubmit_Click"

                    Text="Submit" Width="129px" style="height: 26px" />
            </td>
            <td>
                &nbsp;</td>
        </tr>
        </table>
    <asp:Label ID="Error_Label" runat="server"></asp:Label>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"

        DataSourceID="SqlDataSource" AllowPaging="True" AllowSorting="True" OnSorting="GridView1_Sorting"

        Width="467px" onselectedindexchanged="GridView1_SelectedIndexChanged1">
        <Columns>
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
            <asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
            <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
            <asp:BoundField DataField="Salary" HeaderText="Salary"

                SortExpression="Salary" />
            <asp:BoundField DataField="Age" HeaderText="Age" SortExpression="Age" />
            <asp:BoundField DataField="Gender" HeaderText="Gender"

                SortExpression="Gender" />
        </Columns>

        <EmptyDataTemplate>
            <asp:Label ID="Name" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
            <asp:Label ID="City" runat="server" Text='<%# Eval("City") %>'></asp:Label>
            <asp:Label ID="State" runat="server" Text='<%# Eval("State") %>'></asp:Label>
            <asp:Label ID="Phone" runat="server" Text='<%# Eval("Phone") %>'></asp:Label>
            <asp:Label ID="Salary" runat="server" Text='<%# Eval("Salary") %>'></asp:Label>
            <asp:Label ID="Age" runat="server" Text='<%# Eval("Age") %>'></asp:Label>
            <asp:Label ID="Gender" runat="server" Text="Label"></asp:Label>
        </EmptyDataTemplate>

    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource" runat="server"

        ConnectionString="<%$ ConnectionStrings:newConnectionString %>"

        SelectCommand="SELECT * FROM [page2]"></asp:SqlDataSource>
    </form>
</body>
</html>
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100