473,657 Members | 3,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set the css of a hyperlink in a dataList

73 New Member
I have a datalist that I am using to store a list of hyperlinks.The items for the data list gets added dynamically when the web page is loaded. My problem now come to setting the text color of the HyperLink. How can i set the colour of the Hyper link that is located in the datalist. I know how to set the background color of the datalist Item but this is not what I need to do. This also has to be dynamic because this will change depending on certain conditions that need to be met. Thanks in advance:)
Nov 27 '08 #1
1 1515
dmj07
55 New Member
Hope this can help you. In code behind:

HyperLink hyp = (HyperLink)Data List1.FindContr ol("Hyperlink1" );
hyp.CssClass = //if you want to change the css class
hyp.ForeColor = //to change font color
Nov 27 '08 #2

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

Similar topics

0
2111
by: Arjen | last post by:
Hello, Here is my datalist. <asp:DataList id="myDataList" CellPadding="4" Width="100%" runat="server"> <ItemTemplate> <span class="Normal"> <asp:HyperLink id="link" Text='<%# Server.HtmlEncode((String) DataBinder.Eval(Container.DataItem,"Title")) %>' NavigateUrl='<%# DataBinder.Eval(Container.DataItem,"Url") %>' ToolTip='<%# DataBinder.Eval(Container.DataItem,"Description") %>' runat="server" />
0
2208
by: Dave | last post by:
Hi , I have the following where I need to append a string variable inside a hyperlink template, inside a datalist. The variable 'categoryList' is the culprit. No matter where this variable is declared, the compiler says it is 'undefined'. What am I missing here? I am a newbie to ASP.NET trying to rebuild my ASP library.
1
2803
by: Amil | last post by:
I have a page with a hyperlink (actually in a datalist). I want the URL to do a postback essentially. I tried to use Page.Request in the NavigateUrl, but it's always empty? How do I tell it to use the current page url for the url? <asp:DataList id="dlstItems" runat="server" OnItemCommand="OnItemCommand" SelectedIndex="0"> <ItemTemplate> <asp:HyperLink NavigateUrl="<%# Request.Path %>" Runat="server"> MyLinkText</asp:HyperLink>
2
1769
by: Big E | last post by:
I'm using ASP.Net and SQL Server. I have a table called states. I have 2 forms. On form 1 is the 50 states in textboxes created with a loop. I want to have those 50 or 45 or whatever amount of states have a hyperlink. Once you click the hyperlink it will take the stateId from the click event and use the Get method to send it to the next page. Page 2 will simply use the browswer get method to show information based on that stateid. So my...
9
2715
by: Leon | last post by:
What Am I Doing Wrong? Code Will Not Run, I Can't See The Error! Thanks. <asp:datalist id="DataList1" runat="server" RepeatColumns="4"> <ItemTemplate> <asp:HyperLink id=HyperLink1 ImageUrl= '<%# String.Format("Toyota/Images/Showroom/" & Container.DataItem("PathToDisplyPic"))%>' NavigateUrl='<%#
6
2230
by: Patrick Olurotimi Ige | last post by:
I have a Datalist in a form with a hyperlink i would like to make the hyperlink visible only when a checkbox is clicked and not visible when not clicked . But doing this below in page_load it gives me error:- Object reference not set to an instance of an object. If CheckBox1.Checked = True Then hyperlink1.Visible = True
2
2279
by: milbrand | last post by:
I have an ASPX page with a DataList. The ListItems contain a DropDownList and a Hyper Link. The user selects an Item from the Dropdown box and then selects the hyperlink to edit that item. My thought was to grab the ID, ClientID, or UniqueID of the Hyperlink and then build the name of the DropDownList to grab the value to pass. The problem is that the value keeps coming back Undefined. How can I get the dynamic name created at...
0
1867
by: vidhuraj | last post by:
hi all i have a hyperlink control and image control in my datalist i have binded the values for it ie, datalist will now display some images in image control and their corresponding ID in the hyperlink control. my problem is 1)WHEN THE USER CLICKS ANY ID, IT SHOULD GET REDIRECTED TO ANOTHER PAGE WHERE HE CAN GET A DETAILED INFORMATION ABOUT THE PRODUCT, WITH A BIGGER SIZE PICTURE OF THE PRODUCT
1
5731
by: rn5a | last post by:
Consider the following code: <script runat="server"> Sub Page_Load(obj As Object, ea As EventArgs) Dim sqlReader As SqlDataReader sqlReader = 'calling a function that returns SqlDataReader dlCart.DataSource = sqlReader dlCart.DataBind
1
1585
by: Andy B | last post by:
I have this code: <asp:DataList id="NewsList" runat="server"> <HeaderTemplate> News list </HeaderTemplate> <ItemTemplate> <!-- news article code goes here --> </ItemTemplate> <FooterTemplate>
0
8384
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8302
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8601
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.