/// <summary> /// Gets the ClientID of the given control. /// </summary> /// <param name="control"></param> /// <returns></returns> protected string IdOf(CogitoControl control) { if (control == null) { throw new ArgumentNullException(nameof(control)); } return(control.ClientID); }
/// <summary> /// Renders the specified <see cref="Control"/>. /// </summary> /// <param name="control"></param> protected void Write(CogitoControl control) { if (control == null) { throw new ArgumentNullException(nameof(control), "Cannot render null Control instance."); } if (CurrentWriter == null) { throw new InvalidOperationException(); } control.RenderControl(CurrentWriter); }
/// <summary> /// Renders the Razor template configured for the specified <see cref="CogitoControl"/> instance, to the specified /// <see cref="HtmlTextWriter"/>. This method is best invoked from the <see cref="CogitoControl"/>.Render method. /// </summary> /// <param name="writer"></param> /// <param name="control"></param> /// <param name="controlType"></param> public static void Render(HtmlTextWriter writer, CogitoControl control, Type controlType) { if (writer == null) { throw new ArgumentNullException(nameof(writer)); } if (control == null) { throw new ArgumentNullException(nameof(control)); } if (controlType == null) { throw new ArgumentNullException(nameof(controlType)); } RenderMethod.MakeGenericMethod(controlType) .Invoke(null, new object[] { writer, control }); }