473,387 Members | 1,569 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.

embedding <a href > tag in DataGrid

Hello,

I'm new to ASP.NET but have done quite a bit of classic ASP. I need to
drill down to another page from the DataGrid using a record's ID. In classic
ASP, this was quite easy but I can't find anything equivalent in ASP.NET.

For example, I need to go from a page that lists Customers to a page for
CustomerDetails by allowing the user to click anywhere on the row of the
DataGrid.

I've read about using a TemplateColumn and a lable but it doesn't look like
the same functionality. Any help is very much appreciated.

Regards,

ASP.NET Newbie
Nov 19 '05 #1
2 1668
Hi newbie :)

<asp:DataGrid ID="dg" runat="server" DataSourceID="SqlDataSource1">
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="ProductID"
DataNavigateUrlFormatString="details.aspx?id={0}"
Text="More Details"></asp:HyperLinkColumn>
</Columns>
</asp:DataGrid><asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString1 %>"
SelectCommand="SELECT [ProductID], [ProductName], [SupplierID],
[CategoryID], [QuantityPerUnit] FROM [Alphabetical list of products]">
</asp:SqlDataSource>

That code uses the version 2 datasource control but its the hyperlinkColumn
that you are intrested in.
Let me know if it helped you or not...

Cheers,
Tom Pester
Hello,

I'm new to ASP.NET but have done quite a bit of classic ASP. I need
to drill down to another page from the DataGrid using a record's ID.
In classic ASP, this was quite easy but I can't find anything
equivalent in ASP.NET.

For example, I need to go from a page that lists Customers to a page
for CustomerDetails by allowing the user to click anywhere on the row
of the DataGrid.

I've read about using a TemplateColumn and a lable but it doesn't look
like the same functionality. Any help is very much appreciated.

Regards,

ASP.NET Newbie

Nov 19 '05 #2
Tom,

Thank you very much for the example. The HyperLinkColumn tag worked out
perfectly!

Regards,

The Newbie
"tom pester" wrote:
Hi newbie :)

<asp:DataGrid ID="dg" runat="server" DataSourceID="SqlDataSource1">
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="ProductID"
DataNavigateUrlFormatString="details.aspx?id={0}"
Text="More Details"></asp:HyperLinkColumn>
</Columns>
</asp:DataGrid><asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString1 %>"
SelectCommand="SELECT [ProductID], [ProductName], [SupplierID],
[CategoryID], [QuantityPerUnit] FROM [Alphabetical list of products]">
</asp:SqlDataSource>

That code uses the version 2 datasource control but its the hyperlinkColumn
that you are intrested in.
Let me know if it helped you or not...

Cheers,
Tom Pester
Hello,

I'm new to ASP.NET but have done quite a bit of classic ASP. I need
to drill down to another page from the DataGrid using a record's ID.
In classic ASP, this was quite easy but I can't find anything
equivalent in ASP.NET.

For example, I need to go from a page that lists Customers to a page
for CustomerDetails by allowing the user to click anywhere on the row
of the DataGrid.

I've read about using a TemplateColumn and a lable but it doesn't look
like the same functionality. Any help is very much appreciated.

Regards,

ASP.NET Newbie


Nov 19 '05 #3

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

Similar topics

5
by: Mark Van Orman | last post by:
Hi all, I have an application that logs in xml. Assume <xmlLog></xmlLog>. In this element the app logs anything it gets from foreign hosts. Now if the host sends xml data, the structure of the...
2
by: Isaac Gerg | last post by:
I have a server running PHP on linux. For a website, I want to have the webdocuments stored in XML, then parsed by PHP code to add the appropriate titles, headers, menus, etc. So, I want to...
4
by: matatu | last post by:
Hi to all, I have a xml file, a substring like: &lt;a href=&quot;#&quot;&gt;text&lt;/a&gt; which after an xslt trasform is rendered as (using xsl:output method html): &lt;a...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
6
by: Lasse | last post by:
I have done this simple function, it seems to work as intended, to solve a problem i have had for a while. I couldnt find any sample around that was working for me. I would like to test it with...
3
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like...
2
by: js | last post by:
I have a table rendered with XSLT. The first column has a radio button controls for user to make a selection for a particular row. All the values in the remaining columns are all concated with a...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
2
by: John Grandy | last post by:
I am not having success embedding carriage return and line feed characters into a string and displaying them with an ASP.NET label. Is anyone getting either of the following to work ? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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
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.