<Bindable(True), Category("Behaviour"), DefaultValue("Links.xml"), Description("The name of the XML file to use")> _
Public Overridable Property XMLFile() As String
Get
Return _XMLFile
End Get
Set(ByVal Value As String)
If TypeOf Value Is String Then _XMLFile = Value
If Not New FileInfo(context.Server.MapPath(_XMLFile)).Exists Then
Throw New ApplicationException(String.Format("The XML '{0}' cannot be found", _XMLFile))
End If
End Set
End Property
Public Overridable Property XMLFile() As String
Get
Return _XMLFile
End Get
Set(ByVal Value As String)
If TypeOf Value Is String Then _XMLFile = Value
If Not New FileInfo(context.Server.MapPath(_XMLFile)).Exists Then
Throw New ApplicationException(String.Format("The XML '{0}' cannot be found", _XMLFile))
End If
End Set
End Property
解决方案 »
- 如何获取每个月的星期一、星期二是几号
- FtpWebRequest
- 【代码猴子-培养正确的编程态度和方法】--《编程匠艺》
- .net的页面中自动产生了一些代码,请问是怎样产生的?
- 100分求电子书:PROFESSIONAL ASP.NET 2.0 SPECIAL EDITION
- 如何给用户控件定义属性?急,在线等
- 看看字符串连接的问题??
- 怎样部署asp.net程序
- 刚接了个小case,两个月的花费解决了,散点小分吧!
- WebFrom有無辦法只檢索一次到DataSet中﹐DataGrid翻頁時不用再新從后台數據庫中取數據到DataSet
- 如何取得客户端的Windows登录用户名?
- 把一个汉字"好"转换成utf-8编码 输出到页面
public virtual string XMLFile {
get {
return _XMLFile;
}
set {
if (Value is string) {
_XMLFile = Value;
}
if (!new FileInfo(context.Server.MapPath(_XMLFile)).Exists) {
throw new ApplicationException(string.Format("The XML '{0}' cannot be found", _XMLFile));
}
}
}
给定表达式始终为所提供的(“string”)类型(context.Server.MapPath(_XMLFile)).Exists)
找不到类型或命名空间名称“context”(是否缺少 using 指令或程序集引用?)
部分
Option Explicit On
Option Strict OnImports System.ComponentModel
Imports System.Web.UI
Imports System.Xml
Imports System.IO
Imports SystemNamespace Lyquidity.UtilityLibrary.WebControls <DefaultProperty("Text"), ToolboxData("<{0}:WebPartsControl runat=server></{0}:WebPartsControl>")> _
Public Class WebPartsControl
Inherits System.Web.UI.WebControls.WebControl ' Property variables
Private _XMLFile As String = "Links.xml"
Private _DefaultPage As String = "http://www.google.com"
Private _HTMLSubFolder As String = "HTML" ' Location of the folder containing the Web Part snippets (relative to page on which control is used)
Private _LinkFrame As String = "_Parent" ' XML variables use to retreve information from the l
Private _FrameLinks As XmlNodeList
Private _PopupLinks As XmlNodeList
Private _doc As XmlDocument = New XmlDocument() ' Webpart snippet variables
Private _FrameLink As String
Private _PopupLink As String
Private _LinkGroup As String
Private _WebPart As String ' XML file tag names
Private ReadOnly _LinksMemberTag As String = "/link"
Private ReadOnly _PopupLinkGroupsMemberTag As String = "/group" Private _FrameLinksXPathQuery As String = "/links/framelinks"
Private _PopupLinksXPathQuery As String = "/links/popuplinks" Private _FrameLinkMembersXPathQuery As String = _FrameLinksXPathQuery & _LinksMemberTag
Private _PopupLinkGroupsXPathQuery As String = _PopupLinksXPathQuery & _PopupLinkGroupsMemberTag
public virtual string XMLFile {
get {
return _XMLFile;
}
set {
if (typeof(Value) is string) { //原来这里没有获取Value运行时的类型所以
_XMLFile = Value;
}
if (!new FileInfo(context.Server.MapPath(_XMLFile)).Exists) {
throw new ApplicationException(string.Format("The XML '{0}' cannot be found", _XMLFile));
}
}
}
{
get{
return _XMLFile;
}
set
{
_XMLFile=value;
if(!File.Exists(context.Server.MapPath(_XMLFile)))
throw new ApplicationException(String.Format("The XML '{0}' cannot be found", _XMLFile));
}
}