I have a hyperlink column in my datagrid. I want my hyperlink to be green
or red (depending on in/out status) no matter if the link has been visited
or not. How can I accomplish this? I have tried using CSS but that doesn't
affect what is going on in my datagrid. This is what I have so far for
formatting in my datagrid...
Sub ItemBound(ByVal sender As Object, ByVal e as DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
'check inout field, if In then font is green, if Out then font is
red
Dim strInOut as String = DataBinder.Eval(e.Item.DataItem, "inout")
If strInOut = "In" then
e.Item.ForeColor = System.Drawing.Color.Green
Else
e.Item.ForeColor = System.Drawing.Color.Red
End If
End If
End Sub
Any advice is greatly appreciated....Thanks in advance!
--
Chuck Foster
Programmer Analyst
Eclipsys Corporation - St. Vincent Health System 3 1762
Hi Chuck:
What you came up with is pretty standard fare for putting logic into
the data binding mechanism. You could forego the DataBinder goo since
you are so 'close' to your data source in the code behind. http://odetocode.com/Articles/278.aspx
--
Scott http://www.OdeToCode.com/blogs/scott/
On Tue, 8 Mar 2005 12:09:20 -0600, "chuckdfoster"
<ch**********@hotmail.com> wrote: I have a hyperlink column in my datagrid. I want my hyperlink to be green or red (depending on in/out status) no matter if the link has been visited or not. How can I accomplish this? I have tried using CSS but that doesn't affect what is going on in my datagrid. This is what I have so far for formatting in my datagrid...
Sub ItemBound(ByVal sender As Object, ByVal e as DataGridItemEventArgs) If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then 'check inout field, if In then font is green, if Out then font is red Dim strInOut as String = DataBinder.Eval(e.Item.DataItem, "inout") If strInOut = "In" then e.Item.ForeColor = System.Drawing.Color.Green Else e.Item.ForeColor = System.Drawing.Color.Red End If End If End Sub
Any advice is greatly appreciated....Thanks in advance!
Scott, Thanks for the help, but that just confuses me more. All that does
is change the background color of the cells. I can do that; I just need to
change the color of the hyperlinks. Anymore help is greatly appreciated!
Thanks again!!!
Chuck Foster
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:tj********************************@4ax.com... Hi Chuck:
What you came up with is pretty standard fare for putting logic into the data binding mechanism. You could forego the DataBinder goo since you are so 'close' to your data source in the code behind. http://odetocode.com/Articles/278.aspx
-- Scott http://www.OdeToCode.com/blogs/scott/
On Tue, 8 Mar 2005 12:09:20 -0600, "chuckdfoster" <ch**********@hotmail.com> wrote:
I have a hyperlink column in my datagrid. I want my hyperlink to be
greenor red (depending on in/out status) no matter if the link has been
visitedor not. How can I accomplish this? I have tried using CSS but that
doesn'taffect what is going on in my datagrid. This is what I have so far for formatting in my datagrid...
Sub ItemBound(ByVal sender As Object, ByVal e as DataGridItemEventArgs) If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then 'check inout field, if In then font is green, if Out then font is red Dim strInOut as String = DataBinder.Eval(e.Item.DataItem,
"inout") If strInOut = "In" then e.Item.ForeColor = System.Drawing.Color.Green Else e.Item.ForeColor = System.Drawing.Color.Red End If End If End Sub
Any advice is greatly appreciated....Thanks in advance!
Hi Chuck:
Sorry for the confusion. I only meant to point out some different
techniques to use when data binding - it doesn't show how to achieve
your particular task. Whenever it comes to putting some brains behind
the data binding, hooking an event and using code behind is the
generally accepted approach.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Wed, 9 Mar 2005 15:37:36 -0600, "chuckdfoster"
<ch**********@hotmail.com> wrote: Scott, Thanks for the help, but that just confuses me more. All that does is change the background color of the cells. I can do that; I just need to change the color of the hyperlinks. Anymore help is greatly appreciated!
Thanks again!!! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jouke Langhout |
last post by:
Hello all!
For quite some time now, I've got the following problem:
Access won't close properly when a user closes the application. An
ACCESS process stays active and that process can only be...
|
by: Bradley |
last post by:
I have an A2000 database in which I have a continuous form with a tick
box. There is also a text box with a conditional format that is based on
the expression , if it's true then change the...
|
by: Kumar |
last post by:
Hi Folks,
I have a question regarding conditional hyperlink in datagrid.
I want to display Hyperlink if my QID values in (1,4,5,6) other wise i
want to display just Qdescription with out...
|
by: Wayne Wengert |
last post by:
In a Datagrid I have a field (<td>) in which I want to display a link if a
database field is still Null but I want to display a blank ( ) if that
DB field has a value. If I try to put the...
|
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...
|
by: euan |
last post by:
HI Guys,
I have bee using conditional formatting in the datagrid recently and I
am moving over to framework 2.0 and noticed the datagrid has been
replaced by the gridview. So, I would like to do...
|
by: Stephen |
last post by:
Hi,
Is there anyway I can make a column thats databound into a hyperlink to
navigate to another page?
Suppose I have 3 columns: SortOrder, Description, UserName
for eg:
<Columns>...
|
by: Typehigh |
last post by:
I have many text fields with conditional formatting applied,
specifically when the condition is "Field Has Focus". Without any
events associated with the fields the conditional formatting works...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
| |