Current location: Hot Scripts Forums » Programming Languages » ASP.NET » Hyperlink a tablecell , not the text inside it


Hyperlink a tablecell , not the text inside it

Reply
  #1 (permalink)  
Old 03-19-04, 06:51 AM
aspnoobie aspnoobie is offline
New Member
 
Join Date: Mar 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Hyperlink a tablecell , not the text inside it

hi experts
i am thinking of how can i hyperlink a tablecell using asp.net controls.
i know how to add a hyperlink to a tablecell by
Code:
<script language="vb" runat="server">
sub page_load()
	dim r as new tablerow
	dim c as new tablecell
	r.Cells.add(c)
	table1.rows.add(r)

	Dim h As New HyperLink()
	h.Text = "abc"
	h.NavigateUrl = "somewebsite.htm"
	c.Controls.Add(h)
end sub
</script>
<html>
<body>
<asp:table id="Table1" runat="server" border="1"/>
</body>
</html>
but the text "abc" is actually hyperlink, not the tablecell.i want to know how because i want to retrieve data from the database and create a dynamic table with all the cell hyperlinked to some pages. i work with traditional asp page before and do it using lots of "spagetti" codes. can anyone enlighten me how to use asp.net to do that. thanks in advance!
Reply With Quote
  #2 (permalink)  
Old 03-23-04, 07:00 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by aspnoobie
hi experts
i am thinking of how can i hyperlink a tablecell using asp.net controls.
i know how to add a hyperlink to a tablecell by
Code:
<script language="vb" runat="server">
sub page_load()
	dim r as new tablerow
	dim c as new tablecell
	r.Cells.add(c)
	table1.rows.add(r)
 
	Dim h As New HyperLink()
	h.Text = "abc"
	h.NavigateUrl = "somewebsite.htm"
	c.Controls.Add(h)
end sub
</script>
<html>
<body>
<asp:table id="Table1" runat="server" border="1"/>
</body>
</html>
but the text "abc" is actually hyperlink, not the tablecell.i want to know how because i want to retrieve data from the database and create a dynamic table with all the cell hyperlinked to some pages. i work with traditional asp page before and do it using lots of "spagetti" codes. can anyone enlighten me how to use asp.net to do that. thanks in advance!
Think about using a datagrid or something similiar and modify the column/row templates. That will get you what you want.
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Reply With Quote
  #3 (permalink)  
Old 04-02-04, 09:37 AM
Daemon Daemon is offline
Newbie Coder
 
Join Date: Oct 2003
Location: Virginia
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by aspnoobie
hi experts
i am thinking of how can i hyperlink a tablecell using asp.net controls.
i know how to add a hyperlink to a tablecell by
Code:
<script language="vb" runat="server">
sub page_load()
	dim r as new tablerow
	dim c as new tablecell
	r.Cells.add(c)
	table1.rows.add(r)

	Dim h As New HyperLink()
	h.Text = "abc"
	h.NavigateUrl = "somewebsite.htm"
	c.Controls.Add(h)
end sub
</script>
<html>
<body>
<asp:table id="Table1" runat="server" border="1"/>
</body>
</html>
but the text "abc" is actually hyperlink, not the tablecell.i want to know how because i want to retrieve data from the database and create a dynamic table with all the cell hyperlinked to some pages. i work with traditional asp page before and do it using lots of "spagetti" codes. can anyone enlighten me how to use asp.net to do that. thanks in advance!
The only thing I can think of would be to use the <div> tag inside the cell and set an onclick event handler to make it a link.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Text Automatically Made Into Hyperlink Ryne Script Requests 0 03-10-04 08:14 PM
MySQL Query problem Wraith PHP 5 03-06-04 05:16 PM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 07:19 PM
Placing Flash or Graphics INSIDE text using CSS and Style Filters and DHTML 000 CSS 1 09-03-03 01:43 PM
Scrolling text with hyperlink khushi Script Requests 1 07-22-03 02:02 AM


All times are GMT -5. The time now is 02:52 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.