473,387 Members | 1,592 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,387 software developers and data experts.

Hyperlink column in a datagrid

Hi

asp:DataGrid id="YourID" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn HeaderText="Sample Column">
<ItemTemplate>
<asp:Hyperlink runat="server" Text='<%
#Container.DataItem("TextVal")%>' NavigateUrl='<%
# "page.aspx?Param1=" & Server.UrlEncode
(Container.DataItem("Val1")) & "&Param2=" &
Server.UrlEncode(Container.DataItem("Val2"))'%>/>
</ItemTemplate>
</asp:TemplateColumn>

</Columns>

Ravikanth[MVP]
-----Original Message-----
I have autogeneratecolumns=true in a datagrid. Is it
possible to have a hyperlink column with a URLfield and
formatstring that are dynamically generated without hard
coding them.

<asp:HyperLinkColumn Text="Select" DataNavigateUrlField=<%=ds.Tables("Codes").Columns(0).ColumnName%>
DataNavigateUrlFormatString=<%=path &"?ID={0}"%
</asp:HyperLinkColumn>

Is there any other way like using a template column for

ahyperlink column?
..
.

Nov 17 '05 #1
2 3125
Thanks. But I want the AutoGenerateColumns=TRUE, and then
create a hyperlink column from a dataset. I don't want to
hardcode the column name. Is is not possible to get it
work this way?
-----Original Message-----
Hi

asp:DataGrid id="YourID" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn HeaderText="Sample Column">
<ItemTemplate>
<asp:Hyperlink runat="server" Text='<%
#Container.DataItem("TextVal")%>' NavigateUrl='<%
# "page.aspx?Param1=" & Server.UrlEncode
(Container.DataItem("Val1")) & "&Param2=" &
Server.UrlEncode(Container.DataItem("Val2"))'%>/>
</ItemTemplate>
</asp:TemplateColumn>

</Columns>

Ravikanth[MVP]
-----Original Message-----
I have autogeneratecolumns=true in a datagrid. Is it
possible to have a hyperlink column with a URLfield and
formatstring that are dynamically generated without hard
coding them.

<asp:HyperLinkColumn Text="Select"

DataNavigateUrlField=<%
=ds.Tables("Codes").Columns(0).ColumnName%>
DataNavigateUrlFormatString=<%=path &"?ID={0}"%
</asp:HyperLinkColumn>


Is there any other way like using a template column for

a
hyperlink column?
..
.

.

Nov 17 '05 #2
You could do it that way. Just put the full hyperlink into the database.

Store: <a href="www.msn.com" target="_blank">www.msn.com</a> in your
database and it will show up as www.msn.com in the datagrid.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"dotnet beginner" <sk*****@comsult.com> wrote in message
news:0f****************************@phx.gbl...
Thanks. But I want the AutoGenerateColumns=TRUE, and then
create a hyperlink column from a dataset. I don't want to
hardcode the column name. Is is not possible to get it
work this way?
-----Original Message-----
Hi

asp:DataGrid id="YourID" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn HeaderText="Sample Column">
<ItemTemplate>
<asp:Hyperlink runat="server" Text='<%
#Container.DataItem("TextVal")%>' NavigateUrl='<%
# "page.aspx?Param1=" & Server.UrlEncode
(Container.DataItem("Val1")) & "&Param2=" &
Server.UrlEncode(Container.DataItem("Val2"))'%>/>
</ItemTemplate>
</asp:TemplateColumn>

</Columns>

Ravikanth[MVP]
-----Original Message-----
I have autogeneratecolumns=true in a datagrid. Is it
possible to have a hyperlink column with a URLfield and
formatstring that are dynamically generated without hard
coding them.

<asp:HyperLinkColumn Text="Select"

DataNavigateUrlField=<%
=ds.Tables("Codes").Columns(0).ColumnName%>
DataNavigateUrlFormatString=<%=path &"?ID={0}"%
></asp:HyperLinkColumn>

Is there any other way like using a template column for

a
hyperlink column?
..
.

.

Nov 17 '05 #3

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

Similar topics

2
by: damonf | last post by:
I'm currently trying to add an ASP hyperlink to a template column in a datagrid. The normal hyperlink column doesn't give me the ability to add attributes to the item. In my grid there are four...
2
by: Alex | last post by:
I would like to have one column in my DataGrid that content acts as a hyperlink. In addition to that I would like that the content is databound to a DataSet source. If I create a hyperlink...
9
by: Paul | last post by:
Hi I have a data grid with a hyperlink column. the colum has numbers like 00001,000002, ect. Just wondering how to get the text value of the cell as tempstring =...
1
by: D. Shane Fowlkes | last post by:
Hello All. I keep asking for help with this on the www.asp.net forums and nobody seems to be able to help. What I'm trying to accomplish is very simple. I simply want to create a Hyperlink...
6
by: epigram | last post by:
I'm using the DataGrid with AutoGenerateColumns set to false and choosing which columns I want in the grid by using the <Columns> attribute. What I want to do is to create a hyperlink out of one...
3
by: Tim::.. | last post by:
I currently have the following datagrid but want to turn the name and email column into a hyperlink in the codebehind! Can someone please tell me how I achieve this! Thanks Private Sub...
10
by: david | last post by:
Hi, all: I need a help from you about DataGrid control. I created a DataGrid, dg, in design view of .NET visual Stadio and use the builder to add a Hyperlink column to dg. I want to try to assign...
19
by: Joe | last post by:
I have an aspx page (referred to here as page_1) with a datagrid whose first column contains hyperlinks. When a user clicks one of these hyperlinks, he will navigate to another aspx page (referred...
3
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.