Adding CSS to LinkButton

M

Maziar Aflatoun

Hi,

Does anyone know how I can add a css to the following link button. I want to
add it so that Update, Cancel and Edit have the css in the form of <a
href="" class="">Update</a>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>

Thank you
Maz.
 
K

Ken Cox [Microsoft MVP]

Hey Maz,

You need to create a style class and then assign it to the CssClass
property. Use a template column for this.

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto

<style>
.myclass { font-size: 1.17em;
text-decoration: none;
color: #333399;
}
</style>

<asp:templatecolumn>
<itemtemplate>
<asp:linkbutton CssClass="myclass"
runat="server" Text="Edit" CommandName="Edit"
CausesValidation="false"></asp:linkbutton>
</itemtemplate>
<edititemtemplate>
<asp:linkbutton CssClass="myclass"
runat="server" Text="Update" CommandName="Update"></asp:linkbutton>&nbsp;
<asp:linkbutton CssClass="myclass"
runat="server" Text="Cancel" CommandName="Cancel"
CausesValidation="false"></asp:linkbutton>
</edititemtemplate>
</asp:templatecolumn>
 
M

Maziar Aflatoun

Worked. Thanks
Maz.


Ken Cox said:
Hey Maz,

You need to create a style class and then assign it to the CssClass
property. Use a template column for this.

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto

<style>
.myclass { font-size: 1.17em;
text-decoration: none;
color: #333399;
}
</style>

<asp:templatecolumn>
<itemtemplate>
<asp:linkbutton CssClass="myclass"
runat="server" Text="Edit" CommandName="Edit"
CausesValidation="false"></asp:linkbutton>
</itemtemplate>
<edititemtemplate>
<asp:linkbutton CssClass="myclass"
runat="server" Text="Update" CommandName="Update"></asp:linkbutton>&nbsp;
<asp:linkbutton CssClass="myclass"
runat="server" Text="Cancel" CommandName="Cancel"
CausesValidation="false"></asp:linkbutton>
</edititemtemplate>
</asp:templatecolumn>


Maziar Aflatoun said:
Hi,

Does anyone know how I can add a css to the following link button. I want
to add it so that Update, Cancel and Edit have the css in the form of <a
href="" class="">Update</a>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>

Thank you
Maz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top