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?
This how you Bind title and URL with Grid
Hope this helps. You can also visit this link will give you clear idea about Using Bing API Buena Digital