本文整理汇总了C#中System.Web.UI.WebControls.Panel类的典型用法代码示例。如果您正苦于以下问题:C# Panel类的具体用法?C# Panel怎么用?C# Panel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Panel类属于System.Web.UI.WebControls命名空间,在下文中一共展示了Panel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=F:\git\web-application-dev\online_album\App_Data\Database1.mdf;Integrated Security=True"); //创建连接对象
con.Open();
SqlCommand cmd = new SqlCommand("select * from [photo]", con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Panel box = new Panel();
box.CssClass = "box";
Panel1.Controls.Add(box);
Image photo = new Image();
photo.CssClass = "photo";
photo.ImageUrl = "~/Images/" + dr["uid"].ToString() + "/" + dr["filename"].ToString(); ;
box.Controls.Add(photo);
box.Controls.Add(new Literal() { Text = "<br />" });
Label uid = new Label();
uid.Text = dr["uid"].ToString();
box.Controls.Add(uid);
box.Controls.Add(new Literal() { Text = "<br />" });
Label datetime = new Label();
datetime.Text = dr["datetime"].ToString();
box.Controls.Add(datetime);
}
}
示例2: PopulateCarousel
private void PopulateCarousel()
{
List<BLCategory> categories = BLCategory.RetrieveListFromDB(connectionString);
foreach (BLCategory category in categories)
{
Image image = new Image
{
CssClass = "carousel-image",
ImageUrl = $"ImgHandler.ashx?categoryId={category.Id}"
};
HyperLink link = new HyperLink
{
NavigateUrl = $"/Result.aspx?categoryId={category.Id}"
};
link.Controls.Add(image);
Label captionLabel = new Label
{
Text = $"<h3 style = 'color: #FFFFFF' > {category.Name} </ h3 >"
};
Panel captionPanel = new Panel { CssClass = "carousel-caption" };
captionPanel.Controls.Add(captionLabel);
Panel itemPanel = new Panel { CssClass = "item" };
itemPanel.Controls.Add(link);
itemPanel.Controls.Add(captionPanel);
categoryCarousel.Controls.Add(itemPanel);
}
}
示例3: AddUpdatePanel
private void AddUpdatePanel(Panel p)
{
this.messageLabel = new Label();
this.updatePanel = new UpdatePanel();
this.updatePanel.ID = "ScrudUpdatePanel";
this.updatePanel.ChildrenAsTriggers = true;
this.updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
this.updatePanel.ContentTemplateContainer.Controls.Add(this.topCommandPanel.GetCommandPanel("top"));
this.updatePanel.ContentTemplateContainer.Controls.Add(this.messageLabel);
this.updatePanel.ContentTemplateContainer.Controls.Add(this.gridPanel);
this.updatePanel.ContentTemplateContainer.Controls.Add(this.formPanel);
this.updatePanel.ContentTemplateContainer.Controls.Add(this.bottomCommandPanel.GetCommandPanel("bottom"));
//Bottom command panel.
this.userIdHidden = new HiddenField();
this.userIdHidden.ID = "UserIdHidden";
this.userIdHidden.Value = this.UserId.ToString(CultureInfo.InvariantCulture);
this.officeCodeHidden = new HiddenField();
this.officeCodeHidden.ID = "OfficeCodeHidden";
this.officeCodeHidden.Value = this.OfficeCode;
this.updatePanel.ContentTemplateContainer.Controls.Add(this.userIdHidden);
this.updatePanel.ContentTemplateContainer.Controls.Add(this.officeCodeHidden);
p.Controls.Add(this.updatePanel);
}
示例4: AddReportBody
private void AddReportBody(Panel container)
{
this.reportBody = new Panel();
this.reportBody.ID = "report";
if (!this.NoHeader)
{
this.header = new ReportHeader();
this.header.Path = ConfigurationHelper.GetReportParameter("HeaderPath");
this.reportBody.Controls.Add(this.header);
}
this.reportTitleLiteral = new Literal();
this.reportBody.Controls.Add(this.reportTitleLiteral);
this.topSectionLiteral = new Literal();
this.reportBody.Controls.Add(this.topSectionLiteral);
this.bodyContentsLiteral = new Literal();
this.reportBody.Controls.Add(this.bodyContentsLiteral);
this.gridPlaceHolder = new PlaceHolder();
this.reportBody.Controls.Add(this.gridPlaceHolder);
this.bottomSectionLiteral = new Literal();
this.reportBody.Controls.Add(this.bottomSectionLiteral);
container.Controls.Add(this.reportBody);
}
示例5: CreateControlInternal
protected override WebControl CreateControlInternal(Control container)
{
var panel = new Panel();
container.Controls.Add(panel);
var skinLabel = new Label { Text = LocalizeString("Skin") };
skinLabel.CssClass += "dnnFormSkinLabel";
panel.Controls.Add(skinLabel);
//_skinCombo = new DropDownList { ID = ID + "_SkinComboBox" };
_skinCombo = new DnnComboBox { ID = ID + "_SkinComboBox" };
_skinCombo.CssClass += "dnnFormSkinInput";
_skinCombo.SelectedIndexChanged += SkinIndexChanged;
panel.Controls.Add(_skinCombo);
DnnFormComboBoxItem.BindListInternal(_skinCombo, _skinValue, GetSkins(SkinController.RootSkin), "Key", "Value");
var containerLabel = new Label { Text = LocalizeString("Container") };
containerLabel.CssClass += "dnnFormSkinLabel";
panel.Controls.Add(containerLabel);
//_containerCombo = new DropDownList { ID = ID + "_ContainerComboBox" };
_containerCombo = new DnnComboBox { ID = ID + "_ContainerComboBox" };
_containerCombo.CssClass += "dnnFormSkinInput";
_containerCombo.SelectedIndexChanged += ContainerIndexChanged;
panel.Controls.Add(_containerCombo);
DnnFormComboBoxItem.BindListInternal(_containerCombo, _containerValue, GetSkins(SkinController.RootContainer), "Key", "Value");
return panel;
}
示例6: OnInit
protected override void OnInit(EventArgs e)
{
_Panel = new Panel();
_Panel.ID = this.ID + "_Container";
_Panel.CssClass = "RibbonItems RibbonItems_SmallItem RibbonItemWithMenu";
_Panel.Attributes.Add("ItemID", this.ID);
if (this._width != null) _Panel.Style.Add("width", _width.ToString());
this.Controls.Add(_Panel);
_EnableState(this._enabled);
if (!String.IsNullOrEmpty(this._tooltip))
{
_Panel.CssClass += " RibbonItemWithTooltip";
_Panel.Attributes.Add("tooltip", this._tooltip);
}
Table lTable = new Table();
lTable.Attributes.Add("align", "center");
_Panel.Controls.Add(lTable);
TableRow lTableRow = new TableRow();
lTable.Controls.Add(lTableRow);
TableCell lTableCell = new TableCell();
lTableRow.Controls.Add(lTableCell);
Image lImage = new Image();
lImage.ImageUrl = (!String.IsNullOrEmpty(this._imageurl)) ? this._imageurl : Page.ClientScript.GetWebResourceUrl(this.GetType(), "OfficeWebUI.Resources.Common.Image.blank.gif");
lImage.Width = 16;
lImage.Height = 16;
lTableCell.Controls.Add(lImage);
TableCell lTableCellArrow = new TableCell();
lTableRow.Controls.Add(lTableCellArrow);
Image lArrow = new Image();
lArrow.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "OfficeWebUI.Resources.Common.Image.arrow_dr2.gif");
lTableCellArrow.Controls.Add(lArrow);
_DropDownMenu = new Panel();
_DropDownMenu.ID = this.ID + "_Menu";
_DropDownMenu.CssClass = "RibbonDropDownMenu";
_DropDownMenu.Style.Add("display", "none");
_Panel.Controls.Add(_DropDownMenu);
foreach (Control lCtrl in this._items)
{
_DropDownMenu.Controls.Add(lCtrl);
}
/*
lPanel.Attributes.Add("onclick", "OfficeWebUI.Ribbon.ShowMenu(this, '" + lDropDownMenu.ClientID + "')");
lDropDownMenu.Attributes.Add("onmouseover", "OfficeWebUI.Ribbon.KeepMenu('" + lDropDownMenu.ClientID + "')");
lDropDownMenu.Attributes.Add("onmouseout", "OfficeWebUI.Ribbon.HideMenu('" + lDropDownMenu.ClientID + "')");
lDropDownMenu.Attributes.Add("MenuOpener", lPanel.ClientID);
*/
base.OnInit(e);
}
示例7: LoadGridPanel
private void LoadGridPanel(Panel gridPanel)
{
gridPanel.ID = "GridPanel";
gridPanel.CssClass = this.GridPanelCssClass;
gridPanel.Attributes.Add("style", "overflow:auto");
gridPanel.Attributes.Add("padding", "4px");
if (this.GridPanelHeight.Value > 0)
{
gridPanel.Height = this.GridPanelHeight;
}
if (this.GridPanelWidth.Value > 0)
{
gridPanel.Height = this.GridPanelWidth;
}
this.searchGridView = new MixERPGridView();
this.searchGridView.ID = "SearchGridView";
this.searchGridView.Attributes.Add("style", "white-space: nowrap;");
this.searchGridView.GridLines = GridLines.None;
this.searchGridView.CssClass = this.GridViewCssClass;
this.searchGridView.PagerStyle.CssClass = this.GridViewPagerCssClass;
this.searchGridView.RowStyle.CssClass = this.GridViewRowCssClass;
this.searchGridView.AlternatingRowStyle.CssClass = this.GridViewAlternateRowCssClass;
this.searchGridView.AutoGenerateColumns = true;
this.searchGridView.RowDataBound += this.SearchGridView_RowDataBound;
this.searchGridView.Columns.Add(GetSelectColumnTemplateField());
gridPanel.Controls.Add(this.searchGridView);
}
示例8: Ini
public override void Ini()
{
CssClass = "_devices";
burnerList = new Dictionary<string, Devices>();
burnerList = ((Bake)deviceList[name]).GetBurnerList();
bakeOvenList = ((Bake)deviceList[name]).GetBakeOvenList();
panelName = new Panel();
panelName.CssClass = "_bakePanelName";
labelName = new Label();
labelName.Text = name;
panelName.Controls.Add(labelName);
buttonDelete = new Button();
buttonDelete.Text = "X";
buttonDelete.CssClass = "_buttonDelete";
buttonDelete.Click += Delete_Click;
Controls.Add(panelName);
Controls.Add(buttonDelete);
foreach (var burner in burnerList)
{
Controls.Add(((IDraw)burner.Value).Draw(burner.Key, burnerList));
}
foreach (var oven in bakeOvenList)
{
Controls.Add(((IDraw)oven.Value).Draw(oven.Key, bakeOvenList));
}
}
示例9: CreateControls
private void CreateControls()
{
_panel = new Panel();
_panel.CssClass = "panVolume";
_image = new Image();
_image.ImageUrl = "~/Images/sound_low.png";
_image.CssClass = "imgBt";
_panel.Controls.Add(_image);
_imBtAdd = new ImageButton();
_imBtAdd.ImageUrl = "~/Images/up_plus.png";
_imBtAdd.CssClass = "imgBtV";
_imBtAdd.Click += _imBtAdd_Click;
_panel.Controls.Add(_imBtAdd);
_volumeLabel = new Label();
_volumeLabel.Text = ((IVolume)_data.Device).Volume.ToString();
_volumeLabel.CssClass = "labelVolume";
_panel.Controls.Add(_volumeLabel);
_imBtDel = new ImageButton();
_imBtDel.ImageUrl = "~/Images/down_minus.png";
_imBtDel.CssClass = "imgBt imgBtV";
_imBtDel.Click += _imBtDel_Click;
_panel.Controls.Add(_imBtDel);
Controls.Add(_panel);
}
示例10: ShowPanelPage
public void ShowPanelPage(Panel _panel)
{
try
{
if (Request.QueryString["page"] != null)
{
if (Session["page"] != null)
{
if (!Session["page"].Equals(Request.QueryString["page"]))
{
_panel.Visible = true;
}
else
{
_panel.Visible = false;
}
}
Session["page"] = Request.QueryString["page"];
}
else
{
Session["page"] = 1;
}
}
catch (Exception)
{
}
}
示例11: GenerateShopControls
//Fill page with dynamic controls showing products in database
private void GenerateShopControls()
{
ArrayList coffeeList = ConnectionClass.GetCoffeeByType("%");
foreach (Coffee coffee in coffeeList)
{
//Create Controls
Panel coffeePanel = new Panel();
Image image = new Image { ImageUrl = coffee.Image, CssClass = "ProductsImage" };
Literal literal = new Literal { Text = "<br />" };
Literal literal2 = new Literal { Text = "<br />" };
Label lblName = new Label { Text = coffee.Name, CssClass = "ProductsName" };
Label lblPrice = new Label { Text = String.Format("{0:0.00}",coffee.Price) + "<br />", CssClass = "ProductsPrice" };
TextBox textBox = new TextBox {ID = coffee.Id.ToString(), CssClass = "ProductsTextBox", Text = "0", Width = 60};
//Add validation so only numbers can be entered into the textfields
var validator = new RegularExpressionValidator
{
ValidationExpression = "^[0-9]*",
ControlToValidate = textBox.ID,
ErrorMessage = "Please enter a number."
};
//Add controls to Panels
coffeePanel.Controls.Add(image);
coffeePanel.Controls.Add(literal);
coffeePanel.Controls.Add(lblName);
coffeePanel.Controls.Add(literal2);
coffeePanel.Controls.Add(lblPrice);
coffeePanel.Controls.Add(textBox);
coffeePanel.Controls.Add(validator);
pnlProducts.Controls.Add(coffeePanel);
}
}
示例12: LoadGridPanel
private void LoadGridPanel(Panel gridPanel)
{
gridPanel.ID = "GridPanel";
gridPanel.ScrollBars = ScrollBars.Auto;
gridPanel.CssClass = this.GridPanelCssClass;
if (this.GridPanelHeight != null)
{
gridPanel.Height = this.GridPanelHeight;
}
if (this.GridPanelWidth != null)
{
gridPanel.Height = this.GridPanelWidth;
}
searchGridView = new GridView();
searchGridView.ID = "SearchGridView";
searchGridView.GridLines = GridLines.None;
searchGridView.CssClass = this.GridViewCssClass;
searchGridView.PagerStyle.CssClass = this.GridViewPagerCssClass;
searchGridView.RowStyle.CssClass = this.GridViewRowCssClass;
searchGridView.AlternatingRowStyle.CssClass = this.GridViewAlternateRowCssClass;
searchGridView.AutoGenerateColumns = true;
searchGridView.RowDataBound += this.SearchGridView_RowDataBound;
searchGridView.Columns.Add(this.GetSelectColumnTemplateField());
gridPanel.Controls.Add(searchGridView);
}
示例13: AddEmailAnchor
private void AddEmailAnchor(Panel p)
{
emailAnchor = new HtmlAnchor();
emailAnchor.ID = "SendEmailAnchor";
emailAnchor.InnerHtml = "<img src='" + this.Page.ResolveUrl(MixERP.Net.Common.Helpers.ConfigurationHelper.GetReportParameter("EmailIcon")) + "' />";
p.Controls.Add(emailAnchor);
}
示例14: renderSimilarProduct
private Panel renderSimilarProduct(Item item)
{
Panel similarProductsItemContainer = new Panel();
similarProductsItemContainer.CssClass = "SimilarProductsItemContainer";
Table table = new Table();
TableRow tableRow = new TableRow();
TableCell tableCell = new TableCell();
Panel itemImageBg = new Panel();
itemImageBg.CssClass = "itemImageBg";
Image image = new Image();
image.ImageUrl = item.ImageUrl;
itemImageBg.Controls.Add(image);
tableCell.Controls.Add(itemImageBg);
tableRow.Controls.Add(tableCell);
tableCell = new TableCell();
Panel itemImageTitle = new Panel();
itemImageTitle.CssClass = "itemImageTitle";
Label label = new Label();
label.Text = item.Title;
itemImageTitle.Controls.Add(label);
tableCell.Controls.Add(itemImageTitle);
tableRow.Controls.Add(tableCell);
table.Controls.Add(tableRow);
similarProductsItemContainer.Controls.Add(table);
return similarProductsItemContainer;
}
示例15: BuildCategoryPanel
public static Panel BuildCategoryPanel(BlogEntry entry)
{
Panel categoriesPanel = new Panel();
categoriesPanel.CssClass = "blogPostLabel";
categoriesPanel.Style.Add(HtmlTextWriterStyle.TextAlign, "right");
if (entry.Categories.Count > 0)
{
String category = entry.Categories[0];
HyperLink hyperLink = new HyperLink();
hyperLink.NavigateUrl = "blog.aspx?label=" + category;
hyperLink.Text = category;
categoriesPanel.Controls.Add(hyperLink);
}
for (int i = 1; i < entry.Categories.Count; i++)
{
String category = entry.Categories[i];
Literal labelSeparator = new Literal();
labelSeparator.Text = ", ";
categoriesPanel.Controls.Add(labelSeparator);
HyperLink hyperLink = new HyperLink();
hyperLink.NavigateUrl = "blog.aspx?label=" + category;
hyperLink.Text = category;
categoriesPanel.Controls.Add(hyperLink);
}
return categoriesPanel;
}