Adding CSS to LinkButton

Discussion in 'ASP .Net Datagrid Control' started by Maziar Aflatoun, Feb 15, 2005.

  1. 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.
    Maziar Aflatoun, Feb 15, 2005
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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.
    >
    >
    Ken Cox [Microsoft MVP], Feb 15, 2005
    #2
    1. Advertising

  3. Worked. Thanks
    Maz.


    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >> 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.
    >>
    >>

    >
    Maziar Aflatoun, Feb 15, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Felipe Garcia
    Replies:
    1
    Views:
    5,858
    ElmoWatson
    Aug 28, 2003
  2. Vaibhav
    Replies:
    0
    Views:
    473
    Vaibhav
    Aug 28, 2003
  3. Sheryl Landon
    Replies:
    1
    Views:
    3,551
    Ken Cox [Microsoft MVP]
    Apr 6, 2005
  4. Sathyaish
    Replies:
    3
    Views:
    3,078
    Sathyaish
    Sep 8, 2005
  5. Sathyaish

    Linkbutton does not look like a linkbutton

    Sathyaish, Sep 8, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    167
    Sathyaish
    Sep 8, 2005
Loading...

Share This Page