Archive for October, 2012

Table Cell Padding and Spacing using CSS

Posted: 11th October 2012 in css
Tags:

Okay folks I’m not going to lie. This is a blatant copy of a post on Stack Overflow, but its something I keep forgetting and one for the memory banks.

Here’s the original post by 2astalavista

DEFAULT:

enter image description here

CELLSPACING:

controls the space between table cells

enter image description here

CELLPADDING:

sets the amount of space between the contents of the cell and the cell wall

enter image description here

BOTH:

enter image description here

BOTH SPECIAL:

enter image description here

http://jsfiddle.net/H4emK/

Advertisements

When trying to set the value a data source element to a Boolean value my first attempt was using ToString() on the Boolean value. To me this seemed like a valid way to set the value as can be seen below.

Setting XPath using ToString
  1. this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:isTaskHighlight", this.NamespaceManager).SetValue(this.IsTaskHighlight.ToString());

However, when I tried to use this I received the following error. 

image

On further investigation I found that the ToString() method on a Boolean returns “True” or “False”, not the lower case “true” or “false” InfoPath is looking for.  

To resolve this I created  local method BooleanToString to return the correct value

Infopath boolean to string
  1. private string BooleanToString(bool isTrue)
  2.         {
  3.             return isTrue ? "true" : "false";
  4.         }

And called it to set the value

Setting XPathNavigator to Bool
  1. this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:isTaskHighlight", this.NamespaceManager).SetValue(this.BooleanToString(this.IsTaskHighlight));

job done ! Smile