public string GetValue( ReplaceTag tag ) { string v = ""; if (tag.Name == "dispform") { if (_DispFormUrl == null) _DispFormUrl = this.GetDispFormUrl(_Item["EncodedAbsUrl"].ToString()); //(_Item.ParentList.DefaultViewUrl); v = _DispFormUrl + _Item.ID ; } else if (tag.Name == "dispform2") { if (_DispFormUrl == null) _DispFormUrl = this.GetDispFormUrl2(_Item["EncodedAbsUrl"].ToString()); //(_Item.ParentList.DefaultViewUrl); v = _DispFormUrl + _Item.ID; } else if (tag.Name == "rownumber") { v = _RowNum.ToString(); } else { try { object o = _Item[tag.Name]; return tag.FormatValue(o); //v = o == null ? "" : o.ToString(); } catch (System.ArgumentException ex) { throw new Exception("Tag " + tag.TagValue + " field " + tag.Name + " doesn't exist, please pay attention to the case.", ex); } } return v; }
public string GetValue( ReplaceTag tag ) { string v = ""; if (_List == null) return v; switch (tag.Name.ToLower()) { case "title" : return _List.Title; case "defaultviewurl": return _List.DefaultViewUrl; case "weburl": return _List.ParentWebUrl.EndsWith("/") ? _List.ParentWebUrl : _List.ParentWebUrl + "/" ; case "description": return _List.Description; default : return ""; } }
public string GetValue( ReplaceTag tag ) { string v = ""; switch (tag.Name.ToLower()) { case "title" : return _wp.Title ; case "titleurl": return _wp.TitleUrl ; case "resourcepath" : return _wp.ResourcePath ; case "tooltip": return _wp.ToolTip; case "uniqueid": return _wp.UniqueID; case "clientid": return _wp.ClientID; case "connecterrormessage": return _wp.ConnectErrorMessage; case "cssclass": return _wp.CssClass; case "description": return _wp.Description; case "displaytitle": return _wp.DisplayTitle; //case "rowlimit": // return _wp.RowLimit.ToString() ; case "siteurl": return _wp.SiteUrl; case "subtitle": return _wp.Subtitle; case "width": return "" + _wp.Width; case "height": return "" + _wp.Height; case "helpurl": return _wp.HelpUrl; //case "listname": // return _wp.ListName; case "titleiconimageurl": return _wp.TitleIconImageUrl; //case "imageurl": // return _wp.TitleIconImageUrl; case "wrap": return _wp.Wrap ? "" : "nowrap"; default : return ""; } //if (tag.Name == "viewurl") //{ // v = _Item.Url; //} //else //{ // try // { // object o = _Item[tag.Name]; // v = o == null ? "" : o.ToString(); // } // catch (System.ArgumentException ex) // { // throw new Exception("��ǩ " + tag.TagValue + " ָ�����ֶ� " + tag.Name + " ������,��ע���Сд", ex); // } // if (tag.MaxLength > 0 && v.Length > tag.MaxLength) // { // v = v.Substring(0, tag.MaxLength) + "..."; // } //} return v; }
/// <summary> /// /// </summary> /// <param name="key">Ƥ���Ψһ������Ϊ�������ݵ�����</param> /// <param name="html">Ƥ���ַ���</param> /// <returns></returns> public IList<ReplaceTag> GetReplaceTags(string key, string html) { //if (_CachedSkinTags.ContainsKey(key)) // return (IList<ReplaceTag>)_CachedSkinTags[key]; IList<ReplaceTag> tags = new List<ReplaceTag>(); MatchCollection mc = _reg.Matches(html); foreach (Match m in mc) { ReplaceTag tag = new ReplaceTag(m.Value.Trim()); tags.Add(tag); } //try //{ // _CachedSkinTags.Add(key, tags); //} //catch { } return tags; }