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

GridButtonColumn Style

1 Answer 554 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gareth
Top achievements
Rank 1
Gareth asked on 14 Feb 2014, 03:24 PM
Hi is it possible to alter the style of the gridbuttonColumn, the button background seems to disappear when using enablerowhoverstyle

Thanks
Gareth

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 15 Feb 2014, 03:30 AM
Hi Gareth,

Please take a look at the following code snippet to set the style for GridButtonColumn.

ASPX:
<telerik:GridButtonColumn ButtonType="PushButton" Text="Select" UniqueName="ButtonCol">
</telerik:GridButtonColumn>
. . . .
<ClientSettings EnableRowHoverStyle="true">
</ClientSettings>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
  if (e.Item is GridDataItem)
  {
      GridDataItem dataItem = (GridDataItem)e.Item;
      (dataItem["ButtonCol"].Controls[0] as Button).CssClass = "MyButton";
  }
}

JS:
<style type="text/css">
 .MyButton
 {
   background-color: Red !important;
 }
</style>

Thanks,
Shinu
Tags
Grid
Asked by
Gareth
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or