473,386 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DataSet bound DataGrid with hyperlinks question

I'm reposting my issue with some more info.

I would like to use a DataGrid to display my DataSet.
My DataSet is from a table in a SQL DB.
Both columns in the table are strings.

I would like it to look like the following where the URL column is
clickable.

---------------------------------------------
name | URL
---------------------------------------------
Microsoft | http:\\www.microsoft.com
---------------------------------------------
CNN | http:\\www.cnn.com
---------------------------------------------

I would like to use data binding.

However if I'm using a data bound columns I can't get the hyperlink
functionality. Or I don't know how do this. Is there a simple formatting
trick?

If I use a hyperlink column I can't use data binding.
Nov 18 '05 #1
2 1043
Look into how to to create template columns in the DataGrid to customize
appearance

for example

<asp:DataGrid id="DataGrid1" runat="server">
<columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:label name="lblname" runat="server"
text='<%# DataBinder.Eval(Container.DataItem,"ColumnName") %>' >
</asp:label>
<asp:HyperLink id=lnkImage Runat="server" NavigateUrl='<%#
DataBinder.Eval(Container.DataItem,"Columnlink") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</columns>
</asp:datagrid>
hth
-ashish

Alex wrote:
I'm reposting my issue with some more info.

I would like to use a DataGrid to display my DataSet.
My DataSet is from a table in a SQL DB.
Both columns in the table are strings.

I would like it to look like the following where the URL column is
clickable.

---------------------------------------------
name | URL
---------------------------------------------
Microsoft | http:\\www.microsoft.com
---------------------------------------------
CNN | http:\\www.cnn.com
---------------------------------------------

I would like to use data binding.

However if I'm using a data bound columns I can't get the hyperlink
functionality. Or I don't know how do this. Is there a simple formatting
trick?

If I use a hyperlink column I can't use data binding.

Nov 18 '05 #2
Thanks!

I didn't realize that I can mix and match.
<Columns>
<asp:BoundColumn DataField="Name" HeaderText="col
Name"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Link">
<ItemTemplate>
<asp:HyperLink id=lnk Runat="server"
NavigateUrl='<%#DataBinder.Eval(Container.DataItem ,"mylink")%>'><%#DataBinde
r.Eval(Container.DataItem,"mylink")%></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

"ashish" <as****@mailmenot.com> wrote in message
news:Of**************@TK2MSFTNGP10.phx.gbl...
Look into how to to create template columns in the DataGrid to customize
appearance

for example

<asp:DataGrid id="DataGrid1" runat="server">
<columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:label name="lblname" runat="server"
text='<%# DataBinder.Eval(Container.DataItem,"ColumnName") %>' >
</asp:label>
<asp:HyperLink id=lnkImage Runat="server" NavigateUrl='<%#
DataBinder.Eval(Container.DataItem,"Columnlink") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</columns>
</asp:datagrid>
hth
-ashish

Alex wrote:
I'm reposting my issue with some more info.

I would like to use a DataGrid to display my DataSet.
My DataSet is from a table in a SQL DB.
Both columns in the table are strings.

I would like it to look like the following where the URL column is
clickable.

---------------------------------------------
name | URL
---------------------------------------------
Microsoft | http:\\www.microsoft.com
---------------------------------------------
CNN | http:\\www.cnn.com
---------------------------------------------

I would like to use data binding.

However if I'm using a data bound columns I can't get the hyperlink
functionality. Or I don't know how do this. Is there a simple formatting
trick?

If I use a hyperlink column I can't use data binding.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Neo | last post by:
I was wondering what is the "right" way to deal with datasets is. Particularly sharing DataSets between forms. Here is my situation. I have a simple Customer Database, that holds some information...
3
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called...
2
by: Wing | last post by:
Hi all, I am using Microsoft Visual Studio .NET 2003 to program my code. I have following question. I am trying to adding a few bound columns which from a dataset that containing 2 tables to...
2
by: Robert | last post by:
I'm sure this is a fairly basic question, but I've been looking all over the web for days for suggestions on how to do this. I've got a datagrid that's bound to a dataset on my form. It includes...
0
by: Dave | last post by:
Tried posting in the Winform Forum without much luck, so posting here... After inserting a new data row to a DataTable that is bound to a datagrid, I am unable to change data in a row that is...
2
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different...
0
by: Greg | last post by:
I am working on an application that requires working with numbers in scientific notation. I am using SqlServer as the database and I have created strongly typed data adapters and datasets. The...
0
by: Alex | last post by:
I have a dataset bound datagrid. I added my own columns (autogenerate=false). However I can't figure out how to display a hyperlink string coming from the DB as a functioning hyperlink. What can...
2
by: Alex | last post by:
I'm reposting my issue with some more info. I would like to use a DataGrid to display my DataSet. My DataSet is from a table in a SQL DB. Both columns in the table are strings. I would like...
3
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.