Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6025269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:16:35+00:00 2026-05-23T04:16:35+00:00

<asp:GridView ID=GridView1 runat=server> <Columns> <asp:TemplateField HeaderText=FileName> <ItemTemplate> <asp:HyperLink ID=HyperLink1 runat=server NavigateUrl= Text=></asp:HyperLink> </ItemTemplate> </asp:TemplateField>

  • 0
        <asp:GridView ID="GridView1" runat="server">
        <Columns>
            <asp:TemplateField HeaderText="FileName">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="" Text=""></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
     </Columns>
    </asp:GridView>

aspx.cs file

    SqlCommand comm = new SqlCommand(Select 
        FileUpload.FileName AS FileName,
        FileUpload.FilePath AS PATH,
        SubjectMaster.SubjectName AS Subject,
        MemberPersonalInformation.FirstName As SharedBy 
    from FileUpload",conn)

I need to print FileName(As Hyperlink),SharedBy,Subject in the Grid how can I do that?
I need to do something like this…But below approach not working

        conn.Open();
        SqlDataReader rdr = comm.ExecuteReader();

        int i = 0;
        while (rdr.Read())
        {

            string fip = rdr["PATH"].ToString();
           HyperLink h1 = (HyperLink)GridView1.Rows[i].Cells[0].FindControl("Hyperlink1");
                h1.Text = rdr["FileName"].ToString();
                h1.NavigateUrl = "download.aspx?filepath=" + fip;

                GridView1.Rows[i].Cells[1].Text = rdr["SharedBy"].ToString();
                GridView1.Rows[i].Cells[2].Text = rdr["Subject"].ToString();
                GridView1.Rows[i].Cells[3].Text = rdr["PATH"].ToString();
                //GridView1.Rows[i].Rows.Add(di);

              i++;

        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:16:36+00:00Added an answer on May 23, 2026 at 4:16 am

    Try this:

    <asp:GridView ID="GridView1" runat="server">
      <Columns>
        <asp:TemplateField HeaderText="FileName">
          <ItemTemplate>
            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#Eval("PATH")%>' Text='<%#Eval("FileName")%>'></asp:HyperLink>,
            <asp:Literal ID="Literal1" runat="server" Text='<%#Eval("SharedBy")+", "+ Eval("Subject")%>' />
          </ItemTemplate>
        </asp:TemplateField>
      </Columns>
    /asp:GridView>
    

    In the cs you can bind the grid view with your query like this:

    conn.Open();
    SqlCommand comm = new SqlCommand("your query");
    SqlDataReader rdr = comm.ExecuteReader(CommandBehavior.CloseConnection);
    GridView1.DataSource = rdr;
    GridView1.DataBind();
    rdr.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<asp:GridView ID=GridView1 runat=server CssClass=style29> <Columns> <asp:TemplateField HeaderText=Send Message to Group> <ItemTemplate> <asp:LinkButton ID=LinkButton2 runat=server
I have a Gridview <asp:GridView ID=GridView1 runat=server Width=400px AutoGenerateColumns=false OnSelectedIndexChanged=GridView1_SelectedIndexChanged1> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox
<asp:GridView ID=GridView1 runat=server AutoGenerateColumns=false Height=146px Width=308px> <Columns> <asp:TemplateField HeaderText=Original Price ControlStyle-Width=100px> <ItemTemplate> <asp:TextBox ID=txtOriginalPrice
<asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False DataKeyNames=ID DataSourceID=SqlDataSourceVideo > <Columns> <asp:BoundField DataField=VideoUrl HeaderText=VideoUrl SortExpression=VideoUrl /> <asp:BoundField
<asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False Width=596px DataKeyNames=Key > <Columns> <asp:BoundField DataField=Key HeaderText=Key SortExpression=key Visible=False />
Here's what I have (working) : <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=false> <Columns> <asp:BoundField HeaderText=Id DataField=Id
protected void GridView1_DataBound(object sender, EventArgs e) { GridView1.Columns[0].ItemStyle.Width = 400; <asp:GridView ID=GridView1 runat=server DataSourceID=ObjectDataSource1
I have the the GridView's column looking like that: <Columns> <asp:TemplateField HeaderText=Opcje> <ItemTemplate> <asp:LinkButton
Not giving multiline text in gridview cell <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False DataKeyNames=CategoryID DataSourceID=SqlDataSource1 ShowFooter=true
I want to populate GridView below with images: <asp:GridView ID=GrdDynamic runat=server AutoGenerateColumns=False> <Columns> </Columns>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.