-->

Thursday, May 14, 2015

Hyperlink field Example of ASP.NET Grid View

Hyperlink field  Example of ASP.NET Grid View

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="JobId" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="JobId" HeaderText="JobId" InsertVisible="False" ReadOnly="True" SortExpression="JobId" />
                <asp:BoundField DataField="JobName" HeaderText="JobName" SortExpression="JobName" />
                <asp:BoundField DataField="AboutJob" HeaderText="AboutJob" SortExpression="AboutJob" />
                <asp:BoundField DataField="Salary" HeaderText="Salary" SortExpression="Salary" />
                <asp:HyperLinkField DataNavigateUrlFields="JobId" DataNavigateUrlFormatString="Default2.aspx?JobId={0}" HeaderText="Click to view " Text="details" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [JobId], [JobName], [AboutJob], [Salary] FROM [AddJob]"></asp:SqlDataSource>
   
    </div>
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="JobId" DataSourceID="SqlDataSource2">
            <Columns>
                <asp:BoundField DataField="JobId" HeaderText="JobId" InsertVisible="False" ReadOnly="True" SortExpression="JobId" />
                <asp:BoundField DataField="JobName" HeaderText="JobName" SortExpression="JobName" />
                <asp:BoundField DataField="AboutJob" HeaderText="AboutJob" SortExpression="AboutJob" />
                <asp:BoundField DataField="Experience" HeaderText="Experience" SortExpression="Experience" />
                <asp:BoundField DataField="Qualification" HeaderText="Qualification" SortExpression="Qualification" />
                <asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
                <asp:BoundField DataField="FunctionalArea" HeaderText="FunctionalArea" SortExpression="FunctionalArea" />
                <asp:BoundField DataField="Salary" HeaderText="Salary" SortExpression="Salary" />
                <asp:BoundField DataField="Contact_person" HeaderText="Contact_person" SortExpression="Contact_person" />
                <asp:BoundField DataField="Contact_Person_Numer" HeaderText="Contact_Person_Numer" SortExpression="Contact_Person_Numer">
                <ControlStyle Width="10px" />
                <ItemStyle Width="50px" />
                </asp:BoundField>
                <asp:BoundField DataField="Email_id" HeaderText="Email_id" SortExpression="Email_id" />
                <asp:BoundField DataField="Work" HeaderText="Work" SortExpression="Work" />
                <asp:BoundField DataField="company_name" HeaderText="company_name" SortExpression="company_name" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [AddJob] WHERE ([JobId] = @JobId)">
            <SelectParameters>
                <asp:QueryStringParameter Name="JobId" QueryStringField="JobId" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </form>
</body>
</html>

Code generate the following output

Hyperlink field  Example of ASP.NET Grid View


Read other related articles

Also read other articles

© Copyright 2013 Computer Programming | All Right Reserved