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

Apply css dynamically to RadGrid

2 Answers 441 Views
Grid
This is a migrated thread and some comments may be shown as answers.
saurabh
Top achievements
Rank 1
saurabh asked on 08 Dec 2010, 03:09 PM
Hi All,

I have a textbox and a radgrid on aspx page.
i write the path of css file in that textbox and on textbox's text change event i want to apply the given css to RadGrid to change the display style of the RadGrid (as we can do with Asp.net GridView control). I dont want to use the skins.
How can i apply the css classes to change the style of rows,headers and footers dynamically without creating skins. 

2 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 13 Dec 2010, 11:58 AM
Hello Saurabh,

To achieve the desired functionality you could try overriding the css classes of the RadGrid for headers, footers and rows. On the following online documentation article you could find information about the RadGrid skin css classes:
http://www.telerik.com/help/aspnet-ajax/grdcreatingnewskins.html

Also to override the existing styles you need to set styles with bigger  CSS Selectors’ weight than the existing. For example the following css styles will set background color of RadGrid's header and rows :

<style type="text/css">
 .myClass .RadGrid .rgHeader
 {
      background-image: none;
      background-color: Red;
 }
 .myClass .RadGrid .rgRow
 {
      background-color: Blue;
 }
 .myClass .RadGrid .rgAltRow
 {
      background-color: Green;
 }
</style>

<div class="myClass">
  <telerik:RadGrid runat="server" ID="RadGrid1">
  </telerik:RadGrid>
</div>

Additionally I am sending you a simple example which demonstrates that. Please check it out and let me know if it helps you.

Kind regards,
Radoslav
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Sh
Top achievements
Rank 1
answered on 14 Mar 2013, 02:29 PM
Thank you this solution solved my problem , where i had two radgrids on my page and wanted to apply different styles to each !
Tags
Grid
Asked by
saurabh
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Sh
Top achievements
Rank 1
Share this question
or