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

Dynamic Logout Link - with style?

I'm trying to add a dynamically created logout link on my pages.

The link to the logout page will show if the user is logged in.

I put a placeholder on the aspx page and then dynamically create the link,
if the user is logged.

So far, so good. It's working.

Aspx
<asp:PlaceHolder id="phLogout" runat="server"></asp:PlaceHolder>

Cs
System.Web.UI.HtmlControls.HtmlAnchor hLogout = new HtmlAnchor();
hLogout.ID = "hlLogout";
hLogout.HRef = "logout.aspx";
hLogout.InnerText = "Logout";
phLogout.Controls.Add (hLogout);

But the trouble is, how can add a style to the Logout link?

I have tried using this "Style" attribute without success.

hLogout.Style.Add.??? = ???

As well as:

hLogout.Attributes.CssStyle.??? = ???

Any ideas greatly appreciated.

Jon
Nov 19 '05 #1
2 3455
Hi Jon,

hLogout.Attributes["class"] = "myCSSclass";
hLogout.Style.Add("color","#123456");
hLogout.Style.Add("height","32px");

HTH,

Michel

"Jon Natwick" <no**********@yahoo.com> wrote in message news:<zy*****************@twister.rdc-kc.rr.com>...
I'm trying to add a dynamically created logout link on my pages.

The link to the logout page will show if the user is logged in.

I put a placeholder on the aspx page and then dynamically create the link,
if the user is logged.

So far, so good. It's working.

Aspx
<asp:PlaceHolder id="phLogout" runat="server"></asp:PlaceHolder>

Cs
System.Web.UI.HtmlControls.HtmlAnchor hLogout = new HtmlAnchor();
hLogout.ID = "hlLogout";
hLogout.HRef = "logout.aspx";
hLogout.InnerText = "Logout";
phLogout.Controls.Add (hLogout);

But the trouble is, how can add a style to the Logout link?

I have tried using this "Style" attribute without success.

hLogout.Style.Add.??? = ???

As well as:

hLogout.Attributes.CssStyle.??? = ???

Any ideas greatly appreciated.

Jon

Nov 19 '05 #2
Michel,

You are a genious!

Thank you,
Jon

"fd123456" <fd******@hotmail.com> wrote in message
news:c8*************************@posting.google.co m...
Hi Jon,

hLogout.Attributes["class"] = "myCSSclass";
hLogout.Style.Add("color","#123456");
hLogout.Style.Add("height","32px");

HTH,

Michel

"Jon Natwick" <no**********@yahoo.com> wrote in message
news:<zy*****************@twister.rdc-kc.rr.com>...
I'm trying to add a dynamically created logout link on my pages.

The link to the logout page will show if the user is logged in.

I put a placeholder on the aspx page and then dynamically create the
link,
if the user is logged.

So far, so good. It's working.

Aspx
<asp:PlaceHolder id="phLogout" runat="server"></asp:PlaceHolder>

Cs
System.Web.UI.HtmlControls.HtmlAnchor hLogout = new HtmlAnchor();
hLogout.ID = "hlLogout";
hLogout.HRef = "logout.aspx";
hLogout.InnerText = "Logout";
phLogout.Controls.Add (hLogout);

But the trouble is, how can add a style to the Logout link?

I have tried using this "Style" attribute without success.

hLogout.Style.Add.??? = ???

As well as:

hLogout.Attributes.CssStyle.??? = ???

Any ideas greatly appreciated.

Jon

Nov 19 '05 #3

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

Similar topics

1
by: sujeevan | last post by:
Hi, i have created a web. in the 1st page. user can login.after login i start the session and save it in his db-record. also the page give a link to my important page. in that page i check the...
4
by: paula | last post by:
I've got a problem with asp.net i am trying to make a menu control. and have searched the web for serveral controls but they don't work correctly. I am pretty new to asp.net building. What am i...
2
by: JWL | last post by:
Hi I need to create a bunch of sites with slightly dynamic CSS. Basically, all the image paths in the CSS need to be dynamic, depending on the values of certain ASP variables. I can think of...
1
by: nsvmani | last post by:
Hi, i am trying to get the FileOpen dialogue window as soon as clicked href link I am using IE6 with ActiveX enabled. Just need to get the File Open dialogue window when i click on the HREF links.It...
25
by: crescent_au | last post by:
Hi all, I've written a login/logout code. It does what it's supposed to do but the problem is when I logout and press browser's back button (in Firefox), I get to the last login page. In IE,...
1
by: shrik | last post by:
hi everybody. I have following problem. There are two pages. index.jsp and main.jsp in my application Index.jsp contains logging interface in . It submits password and userid to loginform bean. ...
2
by: David W | last post by:
I need to include a style sheet link in the aspx page based on what user they are. Basically this functionality, but using code behind. Any idea how to change this line to code behind? This...
2
Frinavale
by: Frinavale | last post by:
I've created a ASP.NET control that displays a "book" of schedules. It dynamically displays scheduling times and allows the user to page through the schedules. It also lets the user edit the...
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: 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...
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
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
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,...
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...
0
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,...

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.