.NETGURU
LinkButton CSS Class
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngfreeforall' list.


Collins, Mike
Anyone out there have any ideas how to change the css class of a link button
when you click it? The trick here is, I'm creating the linkButtons
dynamically.

-Mike Collins

***********************************************************************
NOTICE: This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by telephone (404-881-7000) or by electronic mail (Click here to reveal e-mail address), and delete this message and all copies and backups thereof. Thank you.
=======================================================

Reply to this message...
 
    
Will Johansson
Simply add an CssClass argument to the linkbutton during runtime. Should
work for example in C#:

<script language="C#" runat="server">
protected void Page_Load(Object Source, EventArgs e)
{
    if (!IsPostBack) {
        LinkButton1.CssClass = "FirstClass";
    }
}

protected void csBtnClick(Object Source, EventArgs e)
{
    LinkButton1.CssClass = "SecondClass";
}
</script>

Same concept applies in VB.NET:

<script language="VB" runat="server">
Sub Page_Load(Source as Object, e As EventArgs)
    If Not IsPostBack Then LinkButton1.CssClass = "FirstClass"
End Sub

Sub csBtnClick(Source as Object, e As EventArgs)
    LinkButton1.CssClass = "SecondClass"
End Sub
</script>

==== Somewhere in the HTML or ASP control ====

<asp:linkbutton id="LinkButton1" OnClick="csBtnClick" runat="server" />

====

That should do it.

Will

-----Original Message-----
From: Collins, Mike [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 3:11 PM
To: aspngfreeforall
Subject: [aspngfreeforall] LinkButton CSS Class

Anyone out there have any ideas how to change the css class of a link
button
when you click it? The trick here is, I'm creating the linkButtons
dynamically.

-Mike Collins

***********************************************************************
NOTICE: This e-mail message and all attachments transmitted with it may
contain legally privileged and confidential information intended solely
for the use of the addressee. If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, or other use of this message or
its attachments is strictly prohibited. If you have received this
message in error, please notify the sender immediately by telephone
(404-881-7000) or by electronic mail (Click here to reveal e-mail address), and delete
this message and all copies and backups thereof. Thank you.
=======================================================

| ASP.net DOCS = http://www.aspng.com/docs
| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/aspngfreeforall = JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP

Reply to this message...
 
    
Collins, Mike
How do I know which one was clicked? They're named at runtime

-----Original Message-----
From: Will Johansson [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 4:04 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: LinkButton CSS Class

Simply add an CssClass argument to the linkbutton during runtime. Should
work for example in C#:

<script language="C#" runat="server">
protected void Page_Load(Object Source, EventArgs e)
{
    if (!IsPostBack) {
        LinkButton1.CssClass = "FirstClass";
    }
}

protected void csBtnClick(Object Source, EventArgs e)
{
    LinkButton1.CssClass = "SecondClass";
}
</script>

Same concept applies in VB.NET:

<script language="VB" runat="server">
Sub Page_Load(Source as Object, e As EventArgs)
    If Not IsPostBack Then LinkButton1.CssClass = "FirstClass"
End Sub

Sub csBtnClick(Source as Object, e As EventArgs)
    LinkButton1.CssClass = "SecondClass"
End Sub
</script>

==== Somewhere in the HTML or ASP control ====

<asp:linkbutton id="LinkButton1" OnClick="csBtnClick" runat="server" />

====

That should do it.

Will

-----Original Message-----
From: Collins, Mike [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 3:11 PM
To: aspngfreeforall
Subject: [aspngfreeforall] LinkButton CSS Class

Anyone out there have any ideas how to change the css class of a link
button
when you click it? The trick here is, I'm creating the linkButtons
dynamically.

-Mike Collins

***********************************************************************
NOTICE: This e-mail message and all attachments transmitted with it may
contain legally privileged and confidential information intended solely
for the use of the addressee. If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, or other use of this message or
its attachments is strictly prohibited. If you have received this
message in error, please notify the sender immediately by telephone
(404-881-7000) or by electronic mail (Click here to reveal e-mail address), and delete
this message and all copies and backups thereof. Thank you.
=======================================================

| ASP.net DOCS = http://www.aspng.com/docs
| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/aspngfreeforall = JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP

| ASP.net DOCS = http://www.aspng.com/docs
| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/aspngfreeforall = JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP

***********************************************************************
NOTICE: This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by telephone (404-881-7000) or by electronic mail (Click here to reveal e-mail address), and delete this message and all copies and backups thereof. Thank you.
=======================================================

Reply to this message...
 
    
Will Johansson
<asp:linkbutton id="LinkButton1" ::::::OnClick="csBtnClick"::::::
runat="server" />

It calls on the csBtnClick function. You can add arguments for
specifying which button does what or make another csBtnClick function
(for multiple instances, I suggest more complex stuff that you can do
Dim csBtnClick1 As New buttonClickWhatever...).

Like if you have two linkbuttons, simply have two separate functions for
each like csBtnBUTTONIDClick and have it direct to Class2, and have a
second function for the second button.. CsBtnBUTTONID2Click and have it
direct to Class3.

Again, I was just posting the simple concept. Try it out and grasp the
concept, then fool around.

Will

-----Original Message-----
From: Collins, Mike [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 4:07 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: LinkButton CSS Class

How do I know which one was clicked? They're named at runtime

-----Original Message-----
From: Will Johansson [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 4:04 PM
To: aspngfreeforall
Subject: [aspngfreeforall] RE: LinkButton CSS Class

Simply add an CssClass argument to the linkbutton during runtime. Should
work for example in C#:

<script language="C#" runat="server">
protected void Page_Load(Object Source, EventArgs e)
{
    if (!IsPostBack) {
        LinkButton1.CssClass = "FirstClass";
    }
}

protected void csBtnClick(Object Source, EventArgs e)
{
    LinkButton1.CssClass = "SecondClass";
}
</script>

Same concept applies in VB.NET:

<script language="VB" runat="server">
Sub Page_Load(Source as Object, e As EventArgs)
    If Not IsPostBack Then LinkButton1.CssClass = "FirstClass"
End Sub

Sub csBtnClick(Source as Object, e As EventArgs)
    LinkButton1.CssClass = "SecondClass"
End Sub
</script>

==== Somewhere in the HTML or ASP control ====

<asp:linkbutton id="LinkButton1" OnClick="csBtnClick" runat="server" />

====

That should do it.

Will

-----Original Message-----
From: Collins, Mike [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 15, 2002 3:11 PM
To: aspngfreeforall
Subject: [aspngfreeforall] LinkButton CSS Class

Anyone out there have any ideas how to change the css class of a link
button
when you click it? The trick here is, I'm creating the linkButtons
dynamically.

-Mike Collins

***********************************************************************
NOTICE: This e-mail message and all attachments transmitted with it may
contain legally privileged and confidential information intended solely
for the use of the addressee. If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, or other use of this message or
its attachments is strictly prohibited. If you have received this
message in error, please notify the sender immediately by telephone
(404-881-7000) or by electronic mail (Click here to reveal e-mail address), and delete
this message and all copies and backups thereof. Thank you.
=======================================================

| ASP.net DOCS = http://www.aspng.com/docs
| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/aspngfreeforall = JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP

| ASP.net DOCS = http://www.aspng.com/docs
| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/aspngfreeforall = JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP

***********************************************************************
NOTICE: This e-mail message and all attachments transmitted with it may
contain legally privileged and confidential information intended solely
for the use of the addressee. If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, or other use of this message or
its attachments is strictly prohibited. If you have received this
message in error, please notify the sender immediately by telephone
(404-881-7000) or by electronic mail (Click here to reveal e-mail address), and delete
this message and all copies and backups thereof. Thank you.
=======================================================

| ASP.net DOCS = http://www.aspng.com/docs
| [aspngfreeforall] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/aspngfreeforall = JOIN/QUIT
| news://ls.asplists.com = NEWSGROUP

Reply to this message...
 
 
System.EventArgs
System.Web.UI.WebControls.LinkButton




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification