您好我正在尝试为菜单控件编写一个控制适配器。但是我如何阻止它加载 javascript?
它呈现以下行new Sys.WebForms.Menu({ element: 'menu1', disappearAfter: 500, orientation: 'vertical', tabIndex: 0, disabled: false });
我找不到阻止它的方法..
Public Class MenuAdapter
Inherits WebControlAdapter
Private ReadOnly Property Menu As Menu
Get
Return CType(MyBase.Control, Menu)
End Get
End Property
Protected Overrides Sub RenderBeginTag(writer As System.Web.UI.HtmlTextWriter)
If (Not String.IsNullOrEmpty(Control.ClientID)) Then
writer.AddAttribute(HtmlTextWriterAttribute.Id, Control.ClientID)
End If
If (Not String.IsNullOrEmpty(Control.CssClass)) Then
writer.AddAttribute(HtmlTextWriterAttribute.Class, Control.CssClass)
End If
writer.RenderBeginTag(HtmlTextWriterTag.Ul)
End Sub
Protected Overrides Sub RenderEndTag(writer As System.Web.UI.HtmlTextWriter)
writer.WriteLine()
writer.RenderEndTag()
End Sub
Protected Overrides Sub RenderContents(writer As System.Web.UI.HtmlTextWriter)
RenderItems(writer, Menu.Items)
End Sub
Private Sub RenderItems(writer As System.Web.UI.HtmlTextWriter, menuItems As MenuItemCollection)
For Each menuItem As MenuItem In Menu.Items
If (HttpContext.Current.Server.MapPath(menuItem.NavigateUrl).Equals(HttpContext.Current.Request.PhysicalPath, StringComparison.OrdinalIgnoreCase)) Then
writer.AddAttribute("class", Menu.StaticSelectedStyle.CssClass)
End If
writer.RenderBeginTag(HtmlTextWriterTag.Li)
If (Not String.IsNullOrEmpty(menuItem.NavigateUrl)) Then
writer.AddAttribute(HtmlTextWriterAttribute.Href, Menu.ResolveClientUrl(menuItem.NavigateUrl))
writer.RenderBeginTag(HtmlTextWriterTag.A)
writer.Write(menuItem.Text)
writer.RenderEndTag()
Else
writer.Write(menuItem.Text)
End If
If (menuItem.ChildItems.Count > 0) Then
RenderBeginTag(writer)
RenderItems(writer, menuItem.ChildItems)
RenderEndTag(writer)
End If
writer.RenderEndTag()
Next
End Sub
End Class