我有一个asp.net组件:
<SearchWC:ContentBySearchWebPart QueryGroupName="HashTag_TagFeed" id="CERNTagFeed" runat="server" FrameType="None" ResultsPerPage=10
ShouldHideControlWhenEmpty="true" RenderTemplateId="~sitecollection/_catalogs/masterpage/Display Templates/System/Control_TagFeed.js"
AvailableSortsJson="[{'name':'LastModifiedTime','sorts':[{'p':'LastModifiedTime','d':1}]}]"
SelectedPropertiesJson="["PublishingImage" , "PictureURL" , "PictureThumbnailURL" , "Title", "FullPostAuthor", "Path", "Description", "LastModifiedTime", "CollapsingStatus", "Created", "HitHighlightedSummary", "HitHighlightedProperties", "ParentLink", "AttachmentDescription", "AttachmentType", "AttachmentURI", "RootPostID", "ReplyCount", "LikesCount", "FullPostBody"]"
ItemTemplateId="~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Microblog.js"
GroupTemplateId="~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/Group_Content.js"
DataProviderJson= --here should go DPJSON --
/>
在DataProviderJson中,我想插入一个变量,在这里定义:
<script type="text/c#" runat="server">
string foo = "bar";
static SPSite site = new SPSite(SPContext.Current.Web.Url);
static TaxonomySession taxonomySession = new TaxonomySession(site);
static TermStore termStore = taxonomySession.DefaultKeywordsTermStore;
string associatedTerms;
static Term term = termStore.GetTerm(new Guid(HttpContext.Current.Request.Params["TermID"]));
static string test = term.Name;
//term.CustomProperties.TryGetValue("_Sys_HashAssoc", out associatedTerms);
//static string test = term.Name;
static string dpjson = "test value";
</script>
我该怎么做?