internal static void AddExpandoAttribute(Control control, HtmlTextWriter writer, string controlId, string attributeName, string attributeValue, bool encode) { Debug.Assert(control != null); Page page = control.Page; Debug.Assert(page != null); // if writer is not null, assuming the expando attribute is written out explicitly if (writer != null) { if (page.UnobtrusiveValidationMode != UnobtrusiveValidationMode.None) { attributeName = UnobtrusivePrefix + attributeName; } writer.AddAttribute(attributeName, attributeValue, encode); } else { Debug.Assert(page.UnobtrusiveValidationMode == UnobtrusiveValidationMode.None, "The writer must have been passed in the Unobtrusive mode"); // Cannot use the overload of RegisterExpandoAttribute that takes a Control, since that method only works with AJAX 3.5, // and we need to support Validators in AJAX 1.0 (Windows OS Bugs 2015831). if (!page.IsPartialRenderingSupported) { // Fall back to ASP.NET 2.0 behavior page.ClientScript.RegisterExpandoAttribute(controlId, attributeName, attributeValue, encode); } else { // Atlas Partial Rendering support // ScriptManager exists, so call its instance' method for script registration ValidatorCompatibilityHelper.RegisterExpandoAttribute(control, controlId, attributeName, attributeValue, encode); } } }
internal static void AddExpandoAttribute(Control control, HtmlTextWriter writer, string controlId, string attributeName, string attributeValue, bool encode) { if (writer != null) { writer.AddAttribute(attributeName, attributeValue, encode); } else { Page page = control.Page; if (!page.IsPartialRenderingSupported) { page.ClientScript.RegisterExpandoAttribute(controlId, attributeName, attributeValue, encode); } else { ValidatorCompatibilityHelper.RegisterExpandoAttribute(control, controlId, attributeName, attributeValue, encode); } } }