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

How to add an anchor in ASP.NET using VB?

Hi, guys.
I'm using VB.NET to write an ASP page. I use a datagrid to display data from database. I have two types of items: Dry and Frozen. I want to put anchor to these two headers so that whenever I click a hyperlink in the page, I will go to their positions. Here is my partial code:

Expand|Select|Wrap|Line Numbers
  1.  
  2.     Sub dtgCustomers_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
  3.  
  4.         If (e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer) AndAlso (CType(CType(e.Item, TableRow).Cells(0).Controls(0), DataBoundLiteralControl).Text.Trim = ("DRY ITEMS") Or CType(CType(e.Item, TableRow).Cells(0).Controls(0), DataBoundLiteralControl).Text.Trim Like ("FROZEN ITEMS")) Then
  5.             '' CType(CType(e.Item, TableRow).Cells(0).Controls(0), DataBoundLiteralControl).Text.Equals("DRY ITEMS")
  6.             e.Item.Cells(0).ColumnSpan = 9
  7.             e.Item.Cells(0).Font.Bold = True
  8.  
  9.             'e.Item.BackColor = Color.Wheat
  10.             e.Item.BackColor = Color.Goldenrod
  11.             e.Item.Cells(0).Font.Size = FontUnit.Medium
  12.  
  13.  
  14.  
  15.  
  16.             e.Item.Cells.RemoveAt(8)
  17.             e.Item.Cells.RemoveAt(7)
  18.             e.Item.Cells.RemoveAt(6)
  19.             e.Item.Cells.RemoveAt(5)
  20.             e.Item.Cells.RemoveAt(4)
  21.             e.Item.Cells.RemoveAt(3)
  22.             e.Item.Cells.RemoveAt(2)
  23.             e.Item.Cells.RemoveAt(1)
  24.         ElseIf (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) And e.Item.ItemType <> ListItemType.Header Then
  25.             e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor= 'LightSteelBlue'") '' CORAL LAVENDER SlateBlue
  26.  
  27.         End If
  28.         ''  If Not (e.Item.Cells(0).Text.Equals("DRY ITEMS") Or e.Item.Cells(0).Text.Equals("FROZEN ITEMS")) Then
  29.  
  30.         If Not (e.Item.ItemType = ListItemType.Header OrElse e.Item.ItemType = ListItemType.Footer OrElse (CType(CType(e.Item, TableRow).Cells(0).Controls(0), DataBoundLiteralControl).Text.Trim = ("DRY ITEMS")) OrElse (CType(CType(e.Item, TableRow).Cells(0).Controls(0), DataBoundLiteralControl).Text.Trim = ("FROZEN ITEMS"))) Then
  31.             If e.Item.ItemType = ListItemType.Item And e.Item.ItemType <> ListItemType.Header Then
  32.                 e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='White'")
  33.             ElseIf e.Item.ItemType = ListItemType.AlternatingItem And e.Item.ItemType <> ListItemType.Header Then
  34.                 e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#CCCCCC'")
  35.             End If
  36.  
  37.         End If
  38.     End Sub
  39.  
  40.  
  41.  

Anyone got an idea? I know how to do it in html, but i want to do it in VB. So if someone got an idea, please tell me, thanks.



Ben
Jan 5 '07 #1
0 1632

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Chris Kennedy | last post by:
I am passing a querystring e.g. http://office.cybase.co.uk/placeadvert/addimages.asp?maximage=3&officeid=118#subimages I want to use a named anchor. but this confuses my asp as it thinks officeid...
6
by: Daniele Baroncelli | last post by:
Hi guys, I would like to change the text in an anchor. es. from <a id="idanchor">oldtext</a> to
6
by: Richard Brown | last post by:
Ok, I celebrate and rejoice in the Anchor property. So wonderful compared to the horrible 'resize' code I had to write in VB6, there is just no end to the wonders of VB.NET..... uh, ok..... BUT......
3
by: gary | last post by:
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is located in a "/include" folder If you have a...
10
by: elibol | last post by:
Hi, Is there an event that fires when the back or forward button on a browser is pressed? I need an event to fire when someone clicks the back or forward button after an anchor has been set. ...
5
by: Randy Webb | last post by:
The list below has the current section number, proposed anchor name, and then the current title of that section. Some make sense, some don't. There are a few that don't have proposed anchor names...
3
by: Joseph Gruber | last post by:
Hi all -- I have two questions. First, I'm adding a control to my form at runtime and the control/form seems to ignore the anchor property of the runtime control. Any idea how I can get a...
1
by: baskarpr | last post by:
Could somebody help me ? I believe this might be elementary, but I am not much familiar with HTML .In my page i have two frames. I have a number of anchor tags in right frame. Every anchor tag in...
6
by: shapper | last post by:
Hello, On a bottom of a form I have 2 buttons: Submit and Cancel. Submit is an input and submits the form. Cancel should just redirect the user to a new page without submitting the form. I...
1
by: praveenb000 | last post by:
Hi every one, I designed a web page, having horizontal menu using UL and LI tags; I need to be set rollover effect for a menu items. whenever user hover on a menu item, the entire...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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: 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...

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.