472,364 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 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 1659
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: 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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...

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.