1

I have a css class set-up like so:

.cellOneCellPadding {
    padding-left: 9pt !important;
}

Now I am attempting to add the padding to a RadGrid from the C# code behind like this

foreach (GridDataItem row in r.MasterTableView.Items)
{
    row["MainData"].CssClass = "cellOneCellPadding";
}

However, the - 9pt padding on the left is not applied, nor do I get an error. What would be the appropriate way to apply the 9pt padding to one column only of a radgrid?

EDIT
I have also tried

row["MainData"].Style.Add("padding-left", "9pt !important");
row["MainData"].Attributes.Add("padding-left", "9pt !important");
Smith Stanley
  • 461
  • 1
  • 8
  • 25
  • CSS is usually case sensitive. So you should use `row["MainData"].CssClass = "cellOneCellPadding";` – VDWWD Jan 24 '18 at 22:29
  • @VDWWD - good catch. I copy/paste the css classname into the C# code behind and still not being applied – Smith Stanley Jan 24 '18 at 22:33
  • If `row` is the same in HTML as an `` then you need to specify the `td` in the css: `.cellOneCellPadding td {` or specify a cell in that row: `row["MainData"].cell["myCell"]`. – VDWWD Jan 24 '18 at 22:38
  • @VDWWD - see my edit. Am I doing the same thing looping the rows in my foreach loop? – Smith Stanley Jan 24 '18 at 22:42
  • Try `.cellOneCellPadding TD { padding-left: 9pt !important; }`. (I'm not familiar with RadGrid so i cannot say your loop is correct) – VDWWD Jan 24 '18 at 22:44
  • @VDWWD - try that in the C# or in the css – Smith Stanley Jan 24 '18 at 22:46
  • In the CSS file. – VDWWD Jan 24 '18 at 22:46
  • @VDWWD - no such luck. I also have tried the two things I added in my edit to no avail – Smith Stanley Jan 24 '18 at 22:49
  • Inspect the _rendered_ html visually (view source), combined with standard browser dev tools inspection. You'll likely find your answer. – EdSF Jan 25 '18 at 02:10
  • @EdSF - I found the answer from much googling. It is that this product does not render css classes assigned to a pdf. If I was trying to apply the css class for rendering on page it would be successful, but not for the export to pdf function. – Smith Stanley Jan 25 '18 at 14:18

0 Answers0