Hello,
some help here..
I have a gridview, at my home page, binded to a dataset. On the first column is a hyperlink, on which, if click it will go to another, page, Viewer Page, and passes the data to display on the other page

pls advise, preferably in c#..
thanks alot guys

Recommended Answers

All 3 Replies

Here is my code... i have taken a page called image.aspx in that the following is the source code (which consists of a griview with hyperlink)

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

<!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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:FileUpload ID="FileUpload1" runat="server" /><br />
        <br />
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
        <br />
        <br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
            BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1"
            DataKeyNames="QuickLook ID" DataSourceID="SqlDataSource1" GridLines="None">
            <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
            <Columns>
                <asp:BoundField DataField="Full Name" HeaderText="Full Name" SortExpression="Full Name" />
                <asp:BoundField DataField="Name Displayed" HeaderText="Name Displayed" SortExpression="Name Displayed" />
                <asp:BoundField DataField="Birth Day" HeaderText="Birth Day" SortExpression="Birth Day" />
                <asp:BoundField DataField="Access Level" HeaderText="Access Level" SortExpression="Access Level" />
                <asp:BoundField DataField="Team Name" HeaderText="Team Name" SortExpression="Team Name" />
                <asp:BoundField DataField="Joining Date" HeaderText="Joining Date" SortExpression="Joining Date" />
                <asp:HyperLinkField DataNavigateUrlFields="Quicklook Id" DataNavigateUrlFormatString="nextpage.aspx?id={0}"
                    DataTextField="QuickLook ID" />
            </Columns>
            <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
            <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CalendarUtilityConnectionString %>"
            SelectCommand="SELECT * FROM [Employee_Record]"></asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>

After that i have taken another page called newpage.aspx in which i have a another gridview.. which diplays the details from the query string... as follows..
the following is the code behind for newpage.aspx file:

protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(@"Data Source=WINKC185045-MAB\SQLEXPRESS;Initial Catalog=CalendarUtility;Integrated Security=True");
        SqlDataAdapter da = new SqlDataAdapter("select * from Employee_Record where [quicklook id] like '" + Request.QueryString[0] + "'", con);
        DataSet ds = new DataSet();
        da.Fill(ds, "employee_record");

        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
    }

Hope u found the solution !!!!!!!!

Thank You So Much

Mark it as solved if it solves your problem...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.