protected override void CreateChildControls() { CreatePrifix(String.IsNullOrEmpty(this.Title) == true ? this.GetString("命中结果") : this.Title, "content_wrapper"); this.Controls.Add(new LiteralControl("<table class='browse'>")); HiddenField recpathlist = new HiddenField(); recpathlist.ID = "recpathlist"; this.Controls.Add(recpathlist); // 信息行 /* int nPageCount = this.ResultCount / this.PageMaxLines; if ((this.ResultCount % this.PageMaxLines) > 0) nPageCount ++; */ this.Controls.Add(new LiteralControl( "<tr class='info'><td colspan='4'>" )); // 信息文字 LiteralControl resultinfo = new LiteralControl(); resultinfo.ID = "resultinfo"; this.Controls.Add(resultinfo); PageSwitcherControl pager = new PageSwitcherControl(); pager.ID = "pager_top"; if (this.PageNoUrlMode == false) pager.PageSwitch += new PageSwitchEventHandler(pager_PageSwitch); else { pager.EventMode = false; pager.GetBaseUrl += new GetBaseUrlEventHandler(pager_GetBaseUrl); } this.Controls.Add(pager); this.Controls.Add(new LiteralControl( "</td></tr>" )); // tabcontrol this.Controls.Add(new LiteralControl( "<tr class='format'><td colspan='4'>" )); TabControl format_control = new TabControl(); format_control.ID = "format_control"; this.Controls.Add(format_control); this.Controls.Add(new LiteralControl( "</td></tr>" )); format_control.Description = this.GetString("显示格式"); FillFormatControl(format_control); // 标题行 this.Controls.Add(new LiteralControl( "<tr class='columntitle'><td class='no' nowrap>" + this.GetString("序号") + "</td><td class='content'>" + this.GetString("内容") + "</td></tr>" )); // 内容代表 PlaceHolder content = new PlaceHolder(); content.ID = "content"; this.Controls.Add(content); // 内容行 for (int i = 0; #if USE_LINECOUNT i < this.LineCount; #else i < this.PageMaxLines; #endif i++) { PlaceHolder line = NewContentLine(content, i, null); } // 插入点 PlaceHolder insertpoint = new PlaceHolder(); insertpoint.ID = "insertpoint"; content.Controls.Add(insertpoint); // 命令行 CreateCmdLine(); // 调试信息行 PlaceHolder debugline = new PlaceHolder(); debugline.ID = "debugline"; debugline.Visible = false; this.Controls.Add(debugline); CreateDebugLine(debugline); this.Controls.Add(new LiteralControl( // "</table></div>" "</table>" + this.GetPostfixString() )); }
static void FillTabList(TabControl tabcontrol, List<string> formatnames) { StringUtil.RemoveDupNoSort(ref formatnames); tabcontrol.Columns.Clear(); for (int i = 0; i < formatnames.Count; i++) { TabColumn column = new TabColumn(); column.Name = formatnames[i]; tabcontrol.Columns.Add(column); } }
protected override void CreateChildControls() { CreatePrifix(String.IsNullOrEmpty(this.Title) == true ? this.GetString("命中结果") : this.Title, "content_wrapper"); this.Controls.Add(new LiteralControl("<table class='query'>")); // tabcontrol this.Controls.Add(new LiteralControl( "<tr class='format'><td colspan='4'>" )); TabControl format_control = new TabControl(); format_control.ID = "format_control"; this.Controls.Add(format_control); this.Controls.Add(new LiteralControl( "</td></tr>" )); format_control.Description = this.GetString("面板格式"); FillTabControl(format_control); this.Controls.Add(new LiteralControl( // "</table></div>" "</table>" + this.GetPostfixString() )); }
void FillFormatControl(TabControl tabcontrol) { OpacApplication app = (OpacApplication)this.Page.Application["app"]; string strError = ""; List<string> formatnames = null; int nRet = app.GetBrowseFormatNames( this.Lang, null, out formatnames, out strError); if (nRet == -1) { // throw new Exception(strError); this.Page.Response.Write(HttpUtility.HtmlEncode(strError)); this.Page.Response.End(); return; } string strDefaultFormatName = this.DefaultFormatName; // 换算为语言相关的字符串 string strLangName = app.GetBrowseFormatName(strDefaultFormatName, this.Lang); if (String.IsNullOrEmpty(strLangName) == true) strLangName = strDefaultFormatName; // 只好还是用不适合的语言的 if (formatnames.IndexOf(strLangName) == -1) formatnames.Insert(0, strLangName); FillTabList(tabcontrol, formatnames); /* if (string.IsNullOrEmpty(tabcontrol.ActiveTab) == true) tabcontrol.ActiveTab = strLangName; * */ }
void FillTabControl(TabControl tabcontrol) { OpacApplication app = (OpacApplication)this.Page.Application["app"]; string strDefaultFormatName = this.DefaultFormatName; List<string> format_ids = new List<string> { "simple", "simplest", "logic" }; List<string> format_names = new List<string> { this.GetString("simple"), this.GetString("simplest"), this.GetString("logic") }; tabcontrol.Columns.Clear(); for (int i = 0; i < format_ids.Count; i++) { TabColumn column = new TabColumn(); column.Name = format_names[i]; column.ID = format_ids[i]; tabcontrol.Columns.Add(column); if (this.DefaultFormatName == format_ids[i]) tabcontrol.ActiveTab = format_names[i]; } }