/// <summary> /// Adds a class containing <paramref name="prefix"/> and the size suffix ("lg" or "sm") associated with <paramref name="inputSize"/>. /// If <paramref name="inputSize"/> is <see cref="InputSizes.Default"/>, no class is added. /// </summary> /// <param name="control">The <see cref="WebControl"/> to add the CssClass to.</param> /// <param name="inputSize">The <see cref="InputSizes"/>.</param> /// <param name="prefix">A prefix to come before the suffix.</param> public static void EnsureSizeClassPresent(WebControl control, InputSizes inputSize, string prefix) { if (inputSize != InputSizes.Default) { ControlHelper.EnsureCssClassPresent(control, AddSizeSuffix(inputSize, prefix)); } }
/// <summary> /// Adds the size suffix ("lg" or "sm") associated with <paramref name="inputSize"/> to <paramref name="prefix"/>. /// If <paramref name="inputSize"/> is <see cref="InputSizes.Default"/>, an empty string is returned. /// </summary> /// <param name="inputSize">The <see cref="InputSizes"/>.</param> /// <param name="prefix">A prefix to come before the suffix.</param> /// <returns>Concatenation of <paramref name="prefix"/> and the appropriate suffix if <paramref name="inputSize"/> is not <see cref="InputSizes.Default"/>. Otherwise, an empty string.</returns> public static string AddSizeSuffix(InputSizes inputSize, string prefix) { if (inputSize == InputSizes.Large) { return(prefix + "lg"); } else if (inputSize == InputSizes.Small) { return(prefix + "sm"); } else { return(String.Empty); } }