目前,我的代码隐藏了Panel
ItemTemplate
中包含的某些FormView
,这些((Panel)FormView1.FindControl("pnlIsAdmin")).Visible = IsAdmin;
依赖于用户角色。
目前的解决方案:.Databind();
问题是,在Formview完成之前,此代码无法运行.Databind();
现在我对FormViews了解不多,但我确实有一种方法可以将控件(例如上面的面板)隐藏在更好的位置,而不依赖于SEVERE: End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.IntrospectionUtils.callMethodN(IntrospectionUtils.java:379)
at org.apache.tomcat.util.descriptor.web.CallMethodMultiRule.end(WebRuleSet.java:1034)
**Caused by: java.lang.IllegalArgumentException: The servlets named [AxisServlet] and [cxf] are both mapped to the url-pattern [/services/*] which is not permitted
at org.apache.tomcat.util.descriptor.web.WebXml.addServletMapping(WebXml.java:308)**
... 32 more
Aug 19, 2015 5:42:23 PM org.apache.tomcat.util.descriptor.web.WebXmlParser parseWebXml
SEVERE: Parse error in application web.xml file at file:/D:/APP_NAME/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/beA_WS/WEB-INF/web.xml
org.xml.sax.SAXParseException; systemId: file:/D:/APP_NAME/eclipse/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/beA_WS/WEB-INF/web.xml; lineNumber: 49; columnNumber: 21; Error at (49, 21) : The servlets named [AxisServlet] and [cxf] are both mapped to the url-pattern [/services/*] which is not permitted
Caused by: java.lang.IllegalArgumentException: The servlets named [AxisServlet] and [cxf] are both mapped to the url-pattern [/services/*] which is not permitted
at org.apache.tomcat.util.descriptor.web.WebXml.addServletMapping(WebXml.java:308)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.IntrospectionUtils.callMethodN(IntrospectionUtils.java:379)
at org.apache.tomcat.util.descriptor.web.CallMethodMultiRule.end(WebRuleSet.java:1034)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:956)
... 25 more
SEVERE: Marking this application unavailable due to previous error(s) -->
(比如on页面加载)??
感谢您提供任何信息。
答案 0 :(得分:1)
我通常不喜欢混合我的代码隐藏&显示页面,但您可以将控件包装在某些服务器标签中:
<% if(isAdmin){ %> <asp:Panel ID="pnlIsAdmin" runat="server"></asp:Panel> <% } %>