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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:36:19+00:00 2026-06-06T11:36:19+00:00

I am creating a dataTable and then linking it to GridView on my ASP.NET

  • 0

I am creating a dataTable and then linking it to GridView on my ASP.NET webPage, There are two columns in this GridView, I want 2nd Column to be displayed as hyperLink Field. Here is the Code

 protected void btnSearch_Click(object sender, EventArgs e)
{

    DataTable SearchTable = new DataTable();
    DataColumn Title = new DataColumn("Title", typeof(System.String));
    DataColumn url = new DataColumn("url", typeof(System.String));
    SearchTable.Columns.Add(Title);
    SearchTable.Columns.Add(url);
    DataRow ResultRow = null;


    var bingContainer = new Bing.BingSearchContainer(new Uri("https://api.datamarket.azure.com/Bing/Search/"));
    var accountKey = "MyKey";

    // the next line configures the bingContainer to use your credentials.
    bingContainer.Credentials = new NetworkCredential(accountKey, accountKey);

    // now we can build the query
    var webQuery = bingContainer.Web(this.txtSearch.Text, null, null, null, null, null);

    var webResults = webQuery.Execute();

    foreach (var result in webResults)
    {


        ResultRow = SearchTable.NewRow();
        ResultRow["Title"] = result.Title;
        ResultRow["url"] = result.Url;  //I want this Field as a HyperLink

        SearchTable.Rows.Add(ResultRow);
    }

    grdResult.DataSource = SearchTable;
    grdResult.DataBind();


}

Any idea that how could i make “Url” field as a hyperLink Field?

  • 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-06T11:36:21+00:00Added an answer on June 6, 2026 at 11:36 am
    DataTable SearchTable = new DataTable();
    DataColumn Title = new DataColumn("Title", typeof(System.String));
    DataColumn url = new DataColumn("url", typeof(System.String));
    SearchTable.Columns.Add(Title);
    SearchTable.Columns.Add(url);
    DataRow ResultRow = null;
    
    
    var bingContainer = new Bing.BingSearchContainer(new Uri("https://api.datamarket.azure.com/Bing/Search/"));
    var accountKey = "MyKey";
    
    // the next line configures the bingContainer to use your credentials.
    bingContainer.Credentials = new NetworkCredential(accountKey, accountKey);
    
    // now we can build the query
    var webQuery = bingContainer.Web(this.txtSearch.Text, null, null, null, null, null);
    
    var webResults = webQuery.Execute();
    
    foreach (var result in webResults)
    {
    
    
        ResultRow = SearchTable.NewRow();
        ResultRow["Title"] = result.Title;
        ResultRow["url"] = result.Url;  //I want this Field as a HyperLink
    
        SearchTable.Rows.Add(ResultRow);
    }
    
    grdResult.DataSource = SearchTable;
    grdResult.DataBind();
    

    This how you Bind title and URL with Grid

    <asp:GridView ID="grdResult" runat="server" AutoGenerateColumns="False">
            <Columns>
                <asp:TemplateField HeaderText="Title">
                    <HeaderTemplate>
                        Title
                    </HeaderTemplate>
                    <ItemTemplate>
                        <%#DataBinder.Eval(Container.DataItem, "Title")%></span>
                    </ItemTemplate>
                    <FooterTemplate>
                    </FooterTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="URL">
                    <HeaderTemplate>
                        URL
                    </HeaderTemplate>
                    <ItemTemplate>
                        <a href="<%#DataBinder.Eval(Container.DataItem, "url")%>" target="_blank">
                            <%#DataBinder.Eval(Container.DataItem, "url")%></a><br />
                    </ItemTemplate>
                    <FooterTemplate>
                    </FooterTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    

    Hope this helps. You can also visit this link will give you clear idea about Using Bing API Buena Digital

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm creating a shopping website using c# and asp.net and i want to use
I have a gridview I am populating it by creating a datatable filling that
I dream of creating a control which works something like this: <asp:SqlDataSource id=dsFoo runat=server
I've got an odd issue. I'm creating a DataTable type my application then converting
I am programmatically creating a DataGridView object and then binding it to a DataTable
hey guys, recently while creating a webpage with a gridview, while binding the gridview
I want to look at a datatable in my gridview's RowDataBound event and check
I am creating a search results page in C# in an ASP.NET 1.1 page.
In runtime I'm creating a DataTable and using nested for-loops to populate the table.
How can I load a CSV file into a System.Data.DataTable , creating the datatable

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.