本文整理汇总了C#中System.Web.UI.WebControls.PlaceHolder类的典型用法代码示例。如果您正苦于以下问题:C# PlaceHolder类的具体用法?C# PlaceHolder怎么用?C# PlaceHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlaceHolder类属于System.Web.UI.WebControls命名空间,在下文中一共展示了PlaceHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadBlog
public static void loadBlog(DataSet UserDataSet, PlaceHolder BlogHolder, string sort)
{
if (UserDataSet.Tables["Articles"].Rows.Count == 0)
{
BlogHolder.Controls.Add(new LiteralControl("<p>暂无文章</p>"));
}
else
{
DataRow[] dr = UserDataSet.Tables["Articles"].Select("", sort);
for (int i = 0; i < dr.Length; i++)
{
HyperLink articleTitle = new HyperLink();
articleTitle.ID = (i + 1).ToString() + "_Link";
articleTitle.Text = (i + 1).ToString() + "." + dr[i]["title"].ToString();
articleTitle.NavigateUrl = "UserBlog_ArticlesDetails.aspx?par_ArticleID=" + dr[i]["ID"].ToString();
articleTitle.Font.Size = 6;
articleTitle.Font.Bold = true;
BlogHolder.Controls.Add(new LiteralControl("<div style=\"margin-left:10px;margin-top:20px;margin-right:10px;border-bottom:1px dashed;\">"));
BlogHolder.Controls.Add(articleTitle);
BlogHolder.Controls.Add(new LiteralControl("</div>"));
}
}
}
示例2: gen
void gen(PlaceHolder Stats, Log.Items item)
{
Query q = new Query();
q.ExtraSelectElements.Add("Count", "SUM([Log].[Count])");
q.ExtraSelectElements.Add("Day", "DATENAME(DW,[Log].[Date])");
q.QueryCondition = new Q(Log.Columns.Item, item);
q.GroupBy = new GroupBy("DATENAME(DW,[Log].[Date])");
q.Columns = new ColumnSet();
LogSet ls = new LogSet(q);
Dictionary<DayOfWeek, double> weight = new Dictionary<DayOfWeek, double>();
int total = 0;
foreach (Log l in ls)
{
total += (int)l.ExtraSelectElements["Count"];
}
foreach (Log l in ls)
{
double fraction = (double)(int)l.ExtraSelectElements["Count"] / (double)total;
switch ((string)l.ExtraSelectElements["Day"])
{
case "Monday": weight[DayOfWeek.Monday] = fraction; break;
case "Tuesday": weight[DayOfWeek.Tuesday] = fraction; break;
case "Wednesday": weight[DayOfWeek.Wednesday] = fraction; break;
case "Thursday": weight[DayOfWeek.Thursday] = fraction; break;
case "Friday": weight[DayOfWeek.Friday] = fraction; break;
case "Saturday": weight[DayOfWeek.Saturday] = fraction; break;
case "Sunday": weight[DayOfWeek.Sunday] = fraction; break;
default: break;
}
}
Stats.Controls.Add(new LiteralControl("<table><tr><td>Month</td><td>Year</td><td>Weight</td><td>Actual pages</td><td>Weighted pages</td></tr>"));
for (DateTime dtMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-12); dtMonth <= new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dtMonth = dtMonth.AddMonths(1))
{
try
{
double monthWeight = 0.0;
for (DateTime dtDay = dtMonth; dtDay < dtMonth.AddMonths(1) && dtDay < DateTime.Today; dtDay = dtDay.AddDays(1))
{
monthWeight += weight[dtDay.DayOfWeek];
}
Query qMonth = new Query();
qMonth.ExtraSelectElements.Add("Count", "SUM([Log].[Count])");
qMonth.QueryCondition = new And(
new Q(Log.Columns.Item, item),
new Q(Log.Columns.Date, QueryOperator.GreaterThanOrEqualTo, dtMonth),
new Q(Log.Columns.Date, QueryOperator.LessThan, dtMonth.AddMonths(1)),
new Q(Log.Columns.Date, QueryOperator.LessThan, DateTime.Today));
qMonth.Columns = new ColumnSet();
LogSet lsMonth = new LogSet(qMonth);
int actualPages = (int)lsMonth[0].ExtraSelectElements["Count"];
double pagesPerWeek = (double)actualPages / monthWeight;
double pagesPerMonth = pagesPerWeek * 4.345238095;
Stats.Controls.Add(new LiteralControl("<tr><td>" + dtMonth.ToString("MMM") + "</td><td>" + dtMonth.Year + "</td><td>" + monthWeight.ToString("0.00") + "</td><td>" + actualPages.ToString("0") + "</td><td>" + pagesPerMonth.ToString("0") + "</td></tr>"));
// Stats.Controls.Add(new LiteralControl( + " " + + " is " + + " weeks. " + + " pages per week.<br>"));
}
catch { }
}
Stats.Controls.Add(new LiteralControl("</table>"));
}
示例3: pagerlinks
/// <summary>
/// Constructor
/// </summary>
public pagerlinks(int Index, int PageSize, int RecordCount, PlaceHolder ph)
{
this._Index = Index;
this._PageSize = PageSize;
this._RcdCount = RecordCount;
this._placeholder = ph;
}
示例4: Create
/// <summary>
/// Create the control contains all components for the dynamic page configuration.
/// </summary>
/// <param name="dynamicPageConfiguration"></param>
/// <returns></returns>
public Control Create(DynamicPageConfiguration dynamicPageConfiguration)
{
PlaceHolder placeHolder = new PlaceHolder();
bool isTopPanel = true;
foreach (BasePanelConfiguration basePanelConfiguration in dynamicPageConfiguration.Panels)
{
WebControl createdControl = null;
switch (basePanelConfiguration.PanelType)
{
case DynamicPagePanelTypes.ButtonPanel:
createdControl = CreateButtonPanel(basePanelConfiguration);
break;
case DynamicPagePanelTypes.GridViewPanel:
createdControl = CreateGridViewPanel(basePanelConfiguration, dynamicPageConfiguration);
createdControl.Style["margin-top"] = isTopPanel ? "2px" : "4px";
break;
case DynamicPagePanelTypes.QueryPanel:
createdControl = CreateQueryPanel(basePanelConfiguration);
createdControl.Style["margin-top"] = isTopPanel ? "2px" : "4px";
break;
}
if (createdControl != null)
{
isTopPanel = false;
placeHolder.Controls.Add(createdControl);
}
}
return placeHolder;
}
示例5: BuildNotifications
public PlaceHolder BuildNotifications(string userId)
{
DataHandler handler = new DataHandler();
string query;
PlaceHolder ph = new PlaceHolder();
DataTable[] tables = new DataTable[2];
ArrayList messages = new ArrayList();
GroupService groupService = new GroupService();
//http://stackoverflow.com/questions/5672862/check-if-datetime-instance-falls-in-between-other-two-datetime-objects
//notification: you added a teacher
query =
"SELECT * FROM user_UserHasTeachers " +
"WHERE TeacherId = ''" +
"ORDER BY Timestamp";
tables[0] = handler.GetDataTable(query);
foreach (DataRow row in tables[0].Rows)
{
}
//make sense of the data tables
//for each table
foreach (DataTable dt in tables)
{
//check timestamp
//insert into position
}
return ph;
}
示例6: SetData
public void SetData (System.Web.UI.WebControls.PlaceHolder Anchor,
DataHandling DhExisting, int NumberOfDisplayableEntries)
{
m_Anchor = Anchor;
m_Dh = DhExisting;
m_NumberOfDisplayableEntries = NumberOfDisplayableEntries;
}
示例7: showpeiveodl
public void showpeiveodl(DataSet ds, int iden)
{
if (ds.Tables[0].Rows.Count > 0)
{
StreamReader fp;
string folderid = getremembrancefolderName(iden);
string filepath = Server.MapPath("../remembrancefiles/" + folderid + "/" + iden + "/" + "index.html");
string imagePath = Server.MapPath("../remembrancefiles/" + folderid + "/" + iden + "/images");
if (File.Exists(filepath))
{
fp = File.OpenText(Server.MapPath("../remembrancefiles/" + folderid + "/" + iden + "/" + "index.html"));
filecontent = fp.ReadToEnd();
fp.Close();
if (Directory.Exists(imagePath))
{
filecontent = filecontent.Replace("images", "../remembrancefiles/" + folderid + "/" + iden + "/images");
}
}
PlaceHolder pl = new PlaceHolder();
StringBuilder htmlTable = new StringBuilder();
htmlTable.Append(filecontent);
pl.Controls.Add(new Literal { Text = htmlTable.ToString() });
Page.FindControl("mess").Controls.Add(pl);
}
else
{
Response.Redirect("index.aspx");
}
}
示例8: AddReportBody
private void AddReportBody(Panel reportContainer)
{
reportBody = new Panel();
reportBody.ID = "report";
header = new ReportHeader();
header.Path = MixERP.Net.Common.Helpers.ConfigurationHelper.GetSectionKey("MixERPReportParameters", "HeaderPath");
reportBody.Controls.Add(header);
reportTitleLiteral = new Literal();
reportBody.Controls.Add(reportTitleLiteral);
topSectionLiteral = new Literal();
reportBody.Controls.Add(topSectionLiteral);
gridPlaceHolder = new PlaceHolder();
reportBody.Controls.Add(gridPlaceHolder);
bodyContentsLiteral = new Literal();
reportBody.Controls.Add(bodyContentsLiteral);
bottomSectionLiteral = new Literal();
reportBody.Controls.Add(bottomSectionLiteral);
reportContainer.Controls.Add(reportBody);
}
示例9: Add_Main_Viewer_Section
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer)
{
if ((CurrentItem.Behaviors.Can_Be_Described) && (CurrentUser != null))
{
// Determine the number of columns for text areas, depending on browser
int actual_cols = 50;
if (CurrentMode.Browser_Type.ToUpper().IndexOf("FIREFOX") >= 0)
actual_cols = 45;
StringBuilder responseBuilder = new StringBuilder();
responseBuilder.AppendLine("<!-- Add descriptive tage form -->");
responseBuilder.AppendLine("<div class=\"describe_popup_div\" id=\"describe_item_form\" style=\"display:none;\">");
responseBuilder.AppendLine(" <div class=\"popup_title\"><table width=\"100%\"><tr><td align=\"left\">A<span class=\"smaller\">DD </span> I<span class=\"smaller\">TEM </span> D<span class=\"smaller\">ESCRIPTION</span></td><td align=\"right\"> <a href=\"#template\" alt=\"CLOSE\" onclick=\"describe_item_form_close()\">X</a> </td></tr></table></div>");
responseBuilder.AppendLine(" <br />");
responseBuilder.AppendLine(" <fieldset><legend>Enter a description or notes to add to this item </legend>");
responseBuilder.AppendLine(" <br />");
responseBuilder.AppendLine(" <table class=\"popup_table\">");
// Add comments area
responseBuilder.Append(" <tr align=\"left\" valign=\"top\"><td><br /><label for=\"add_notes\">Notes:</label></td>");
responseBuilder.AppendLine("<td><textarea rows=\"10\" cols=\"" + actual_cols + "\" name=\"add_tag\" id=\"add_tag\" class=\"add_notes_textarea\" onfocus=\"javascript:textbox_enter('add_tag','add_notes_textarea_focused')\" onblur=\"javascript:textbox_leave('add_tag','add_notes_textarea')\"></textarea></td></tr>");
responseBuilder.AppendLine(" </table>");
responseBuilder.AppendLine(" <br />");
responseBuilder.AppendLine(" </fieldset><br />");
responseBuilder.AppendLine(" <center><a href=\"\" onclick=\"return describe_item_form_close();\"><img border=\"0\" src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/buttons/cancel_button_g.gif\" alt=\"CLOSE\" /></a> <input type=\"image\" src=\"" + CurrentMode.Base_URL + "design/skins/" + CurrentMode.Base_Skin + "/buttons/save_button_g.gif\" value=\"Submit\" alt=\"Submit\" ></center><br />");
responseBuilder.AppendLine("</div>");
responseBuilder.AppendLine();
placeHolder.Controls.Add(new Literal() { Text = responseBuilder.ToString() });
}
}
示例10: Add_Main_Viewer_Section
/// <summary> Adds the main view section to the page turner </summary>
/// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("Feature_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
}
// Build the value
StringBuilder builder = new StringBuilder(5000);
// Save the current viewer code
string current_view_code = CurrentMode.ViewerCode;
// Start the citation table
builder.AppendLine("\t\t<!-- FEATURE VIEWER OUTPUT -->" );
builder.AppendLine("\t\t<td align=\"left\" height=\"40px\" ><span class=\"SobekViewerTitle\"><b>Index of Features</b></span></td></tr>" );
builder.AppendLine("\t\t<tr><td class=\"SobekDocumentDisplay\">");
builder.AppendLine("\t\t\t<div class=\"SobekCitation\">");
// Get the list of streets from the database
Map_Features_DataSet features = SobekCM_Database.Get_All_Features_By_Item( CurrentItem.Web.ItemID, Tracer );
Create_Feature_Index( builder, features );
// Finish the citation table
builder.AppendLine( "\t\t\t</div>" );
builder.AppendLine("\t\t</td>" );
builder.AppendLine("\t\t<!-- END FEATURE VIEWER OUTPUT -->" );
// Restore the mode
CurrentMode.ViewerCode = current_view_code;
// Add the HTML for the image
Literal mainLiteral = new Literal {Text = builder.ToString()};
placeHolder.Controls.Add( mainLiteral );
}
示例11: Add_Main_Viewer_Section
/// <summary> Adds the main view section to the page turner </summary>
/// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("EmbeddedVideo_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
}
//Determine the name of the FLASH file
string youtube_url = CurrentItem.Bib_Info.Location.Other_URL;
if (youtube_url.IndexOf("watch") > 0)
youtube_url = youtube_url.Replace("watch?v=", "v/") + "?fs=1&hl=en_US";
const int width = 600;
const int height = 480;
// Add the HTML for the image
StringBuilder result = new StringBuilder(500);
result.AppendLine(" <!-- EMBEDDED VIDEO VIEWER OUTPUT -->");
result.AppendLine(" <td align=\"left\"><span class=\"SobekViewerTitle\"><b>Streaming Video</b></span></td>");
result.AppendLine(" </tr>");
result.AppendLine(" <tr>");
result.AppendLine(" <td class=\"SobekCitationDisplay\">");
result.AppendLine(CurrentItem.Behaviors.Embedded_Video);
result.AppendLine(" </td>");
result.AppendLine(" <!-- END EMBEDDED VIDEO VIEWER OUTPUT -->");
Literal mainLiteral = new Literal { Text = result.ToString() };
placeHolder.Controls.Add(mainLiteral);
}
示例12: Add_Main_Viewer_Section
/// <summary> Adds the main view section to the page turner </summary>
/// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("YouTube_Embedded_Video_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
}
//Determine the name of the FLASH file
string youtube_url = CurrentItem.Bib_Info.Location.Other_URL;
if ( youtube_url.IndexOf("watch") > 0 )
youtube_url = youtube_url.Replace("watch?v=","v/") + "?fs=1&hl=en_US";
const int width = 600;
const int height = 480;
// Add the HTML for the image
StringBuilder result = new StringBuilder(500);
result.AppendLine(" <!-- YOU TUBE VIEWER OUTPUT -->");
result.AppendLine(" <td align=\"left\"><span class=\"SobekViewerTitle\"><b>Streaming Video</b></span></td>");
result.AppendLine(" </tr>");
result.AppendLine(" <tr>");
result.AppendLine(" <td class=\"SobekCitationDisplay\">");
result.AppendLine(" <object width=\"" + width + "\" height=\"" + height + "\">");
result.AppendLine(" <param name=\"allowscriptaccess\" value=\"always\" />");
result.AppendLine(" <param name=\"movie\" value=\"" + youtube_url + "\" />");
result.AppendLine(" <param name=\"allowFullScreen\" value=\"true\"></param>");
result.AppendLine(" <embed src=\"" + youtube_url + "\" type=\"application/x-shockwave-flash\" AllowScriptAccess=\"always\" allowfullscreen=\"true\" width=\"" + width + "\" height=\"" + height + "\"></embed>");
result.AppendLine(" </object>");
result.AppendLine(" </td>" );
result.AppendLine(" <!-- END YOU TUBE VIEWER OUTPUT -->" );
Literal mainLiteral = new Literal {Text = result.ToString()};
placeHolder.Controls.Add(mainLiteral);
}
示例13: OnInit
protected override void OnInit(EventArgs e)
{
Title = "View \"" + SelectedItem.Title + "\"";
// Get selected property from content item.
ContentType contentType = Zeus.Context.Current.ContentTypes[SelectedItem.GetType()];
foreach (IContentProperty property in contentType.Properties)
{
PlaceHolder plcDisplay = new PlaceHolder();
Panel panel = new Panel { CssClass = "editDetail" };
HtmlGenericControl label = new HtmlGenericControl("label");
label.Attributes["class"] = "editorLabel";
label.InnerText = property.Name;
panel.Controls.Add(label);
plcDisplay.Controls.Add(panel);
plcDisplayers.Controls.Add(plcDisplay);
IDisplayer displayer = contentType.GetDisplayer(property.Name);
if (displayer != null)
{
//displayer.AddTo(this, contentItem, this.PropertyName);
displayer.InstantiateIn(panel);
displayer.SetValue(panel, SelectedItem, property.Name);
}
else
{
panel.Controls.Add(new LiteralControl("{No displayer}"));
}
panel.Controls.Add(new LiteralControl(" "));
}
base.OnInit(e);
}
示例14: displayShow
private void displayShow(PlaceHolder placeholder, int shid)
{
placeholder.Controls.Clear();
Show show = new Show();
show.id = Convert.ToInt32(Request["shid"]);
show.get();
TextBox tickets = new TextBox();
tickets.ID = "numOfTickets";
Button order = new Button();
order.Text = "Order!";
order.Click += new System.EventHandler(this.orderClick);
HiddenField hiddenShid = new HiddenField();
hiddenShid.Value = shid.ToString();
hiddenShid.ID = "hiddenShid";
placeholder.Controls.Add(new LiteralControl("<h1>"+show.read("moid", true)+" @ "+show.read("show_start")+"</h1>"));
placeholder.Controls.Add(new LiteralControl("<p>### tickets left</p>"));
placeholder.Controls.Add(new LiteralControl("<p>Please input # of tickets you want to order</p>"));
placeholder.Controls.Add(tickets);
placeholder.Controls.Add(order);
placeholder.Controls.Add(new LiteralControl("<br /><br /><a href=\"order_ticket.aspx\">Back to show list</a>"));
placeholder.Controls.Add(hiddenShid);
}
示例15: Add_Main_Viewer_Section
/// <summary> Adds the main view section to the page turner </summary>
/// <param name="placeHolder"> Main place holder ( "mainPlaceHolder" ) in the itemNavForm form into which the the bulk of the item viewer's output is displayed</param>
/// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
public override void Add_Main_Viewer_Section(PlaceHolder placeHolder, Custom_Tracer Tracer)
{
if (Tracer != null)
{
Tracer.Add_Trace("Download_Only_ItemViewer.Add_Main_Viewer_Section", "Adds one literal with all the html");
}
// Build the value
StringBuilder builder = new StringBuilder(1500);
// Save the current viewer code
string current_view_code = CurrentMode.ViewerCode;
// Start the citation table
builder.AppendLine("\t\t<!-- DOWNLOAD ONLY VIEWER OUTPUT -->" );
builder.AppendLine("\t\t<td class=\"SobekDocumentDisplay\">" );
builder.AppendLine("\t\t\t<div class=\"SobekCitation\">" );
builder.AppendLine("\t\t\t</div>" );
// Finish the table
builder.AppendLine( "\t\t</td>" );
builder.AppendLine("\t\t<!-- END DOWNLOAD ONLY VIEWER OUTPUT -->" );
// Restore the mode
CurrentMode.ViewerCode = current_view_code;
// Add the HTML for the image
Literal mainLiteral = new Literal {Text = builder.ToString()};
placeHolder.Controls.Add( mainLiteral );
}