This is a migrated thread and some comments may be shown as answers.

Prevent hard-coded styles in grid buttons

2 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
y0mbo
Top achievements
Rank 1
y0mbo asked on 12 Aug 2008, 01:12 PM
I have a grid with paging for which I am defining my own style sheet values.
However, the paging buttons are assigned styles directly to the object, which prevents my CSS from being applied.

The rendered html looks like this:

<input class="rgPagePrev" type="button" style="border-style: none; border-color: rgb(209, 68, 20); color: White; background-color: rgb(0, 51, 102); font-family: Verdana; font-size: 8pt; font-weight: bold;" title="Previous Page" onclick="javascript:__doPostBack('ctl00$ApplicationContent$DepartmentsRadGrid$ctl00$ctl03$ctl01$ctl02','')" value=" " name="ctl00$ApplicationContent$DepartmentsRadGrid$ctl00$ctl03$ctl01$ctl02"/> 

How do I turn this off, so they use just the styles from my style sheet? (i.e. I do not want the "style" tag to render on the control.

My radGrid is as follows:

  <telerik:RadGrid ID="DepartmentsRadGrid" AutoGenerateColumns="false" AllowPaging="true" 
    AllowSorting="true" EnableEmbeddedSkins="false"  EnableLinqExpressions="false" GridLines="None" 
    PageSize="25" OnItemCommand="DepartmentsGrid_OnItemCommand" OnItemDataBound="DepartmentsRadGrid_OnItemDataBound" 
    SkinID="Grid" Width="600" runat="server"
    <MasterTableView> 
      <Columns> 
        <telerik:GridBoundColumn DataField="DepartmentId" HeaderText="DepartmentId" UniqueName="DepartmentId" 
          Visible="false"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DepartmentNumber" HeaderText="Dept #" UniqueName="DepartmentNumber" 
          Visible="true"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Description" HeaderText="Name" UniqueName="Description" 
          Visible="true"
        </telerik:GridBoundColumn> 
        <telerik:GridTemplateColumn AllowFiltering="false"
          <ItemTemplate> 
            <asp:ImageButton ID="UpdateLinkButton" ImageUrl="edit.gif" 
              CausesValidation="false" CommandArgument='<%# Eval("DepartmentId")%>' CommandName="update" 
              runat="server" /> 
            <asp:ImageButton ID="DeleteLinkButton" CommandName="delete" ImageUrl="delete.gif" 
              runat="server" /> 
          </ItemTemplate> 
        </telerik:GridTemplateColumn> 
      </Columns> 
    </MasterTableView> 
  </telerik:RadGrid> 

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 12 Aug 2008, 02:15 PM
Hello John,

Thank you for the provided code snippets.

However, RadGrid never renders inline styles for the paging arrows automatically. The style attribute must be coming from somewhere else. Please check your web application (code-behind, ASP.NET themes, etc).

You can easily override the inline styles by using CSS rules with the !important keyword, but I would try to find where where the style attribute come from.


Greetings,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
y0mbo
Top achievements
Rank 1
answered on 13 Aug 2008, 06:01 PM
Actually the answer is setting EnableTheming="false".
Tags
Grid
Asked by
y0mbo
Top achievements
Rank 1
Answers by
Dimo
Telerik team
y0mbo
Top achievements
Rank 1
Share this question
or