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 8805733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:56:32+00:00 2026-06-14T01:56:32+00:00

I have a gridview that gets data from an sqldatasource and as a results

  • 0

I have a gridview that gets data from an sqldatasource and as a results gets 3 columns from an SQL query: ID, description and price.

What I want to do is adding another column with an hyperlink in the format of page.aspx?id=x where x is the ID code from the first column. This for each row in the table.

I’ve been looking all morning for how to do this, all I got is that I have to manage the RowDataBound event and use an hyperlinkfield but couldn’t find anything else that explained how they actually work together, even the msdn article is kind of vague on the subject or just doesn’t have any relevant help for my specific case as I’m managing the gridview from the code-behind.
Also haven’t been able to figure how to access strings from the other columns, since it’s what I need to insert in the resulting hyperlink.

Here’s what I got so far for the creation of the gridview:

private void FillGrid(string qid)
{
    SqlDataSource1.ConnectionString = Connessione.connectionString;
    SqlDataSource1.SelectCommand = "SELECT art_tessuto_articolo, art_tessuto_descrizione, lipre_prezzo FROM lipre INNER JOIN listini_tessuti ON lipre.lipre_codice = listini_tessuti.listini_codice INNER JOIN art_tessuti ON lipre.lipre_articolo = art_tessuti.art_tessuto_articolo WHERE lipre_codice = @qid AND lipre_prezzo <> 0";
    SqlDataSource1.SelectParameters.Clear();
    SqlDataSource1.SelectParameters.Add("qid", qid);

    GridView1.AllowPaging = true;
    GridView1.PageSize = 500;
    GridView1.DataSource = SqlDataSource1;

    GridView1.DataBind();


}
  • 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-06-14T01:56:33+00:00Added an answer on June 14, 2026 at 1:56 am

    This should do the job.

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
           HyperLink hlControl = new HyperLink();
           hlControl.Text = e.Row.Cells[0].Text; 
           hlControl.NavigateUrl = "page.aspx?id=" + e.Row.Cells[0].Text;
           e.Row.Cells[3].Controls.Add(hlControl);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview setup that gets its data from a SQL database stored
I have a GridView that gets it's data from the SQL database . I
I have a GridView that gets populated with data from a SQL database, very
I have data that gets displayed in gridview. If I'm pulling it from one
I have a gridview that gets its data from a webservice. This comes into
Hey guys, I have an application that I want to display some data from
I have a gridview that displays data from a database. The datbase stores the
I have a gridview on my page that gets bound to user search results.
Background : I have a GridView which gets populated from an SqlDataSource via DataSourceID.
I have a GridView that has 3 columns: FirstName, LastName and a TemplateField FullName

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.