Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Collections.Generic;
- using System.Xml;
- namespace BillMatrix.Customers.Biller.ConsumerWeb
- {
- public partial class Banner : System.Web.UI.UserControl
- {
- // Private vars and default values
- private string _scenario;
- private string _source;
- private string _link = "#";
- private string _class = "dynamic-banner";
- private string _target = "_blank";
- private string _width = "0";
- private string _height = "0";
- private string _text = "";
- private HyperLink _hl = new HyperLink();
- protected void Page_Load(object sender, EventArgs e)
- {
- ReadXMLDocument(_scenario);
- }
- // Find the scenario in the XML file, grab the attributes listed there,
- // and populate the phBanner element with a new banner.
- private void ReadXMLDocument(string scenario)
- {
- XmlDocument bannerDoc = new XmlDocument();
- bannerDoc.Load(Server.MapPath("~/ewallet/BannerConfig.xml"));
- XmlNodeList scenarioGroup = bannerDoc.SelectNodes("//banners/scenario[@type='" + Scenario + "']");
- // Are there any scenarios that match?
- if (scenarioGroup.Count > 0)
- {
- bannerPnl.Visible = true;
- foreach (XmlNode node in scenarioGroup)
- {
- Source = node["bannersrc"].InnerText;
- Link = node["bannerlink"].InnerText;
- Class = node["class"].InnerText;
- Width = node["width"].InnerText;
- Height = node["height"].InnerText;
- Text = node["text"].InnerText;
- Target = node["target"].InnerText;
- _hl.NavigateUrl = Link;
- _hl.CssClass = Class;
- _hl.Style.Add("background" , "url('" + Source + "') left top no-repeat;");
- _hl.Style.Add("width" , Width + "px");
- _hl.Style.Add("padding-top" , Height + "px;");
- _hl.Text = Text;
- _hl.Target = Target;
- }
- phBanner.Controls.Add(_hl);
- }
- }
- public string Scenario
- {
- get { return _scenario; }
- set { _scenario = value; }
- }
- public string Source
- {
- get { return _source; }
- set { _source = value; }
- }
- public string Link
- {
- get { return _link; }
- set
- {
- if (value != "")
- {
- _link = value;
- }
- }
- }
- public string Class
- {
- get { return _class; }
- set {
- if (value != "")
- {
- _class = value;
- }
- }
- }
- public string Width
- {
- get { return _width; }
- set
- {
- if (value != "")
- {
- _width = value;
- }
- }
- }
- public string Height
- {
- get { return _height; }
- set
- {
- if (value != "")
- {
- _height = value;
- }
- }
- }
- public string Text
- {
- get { return _text; }
- set
- {
- if (value != "")
- {
- _text = value;
- }
- }
- }
- public string Target
- {
- get { return _target; }
- set
- {
- if (value != "")
- {
- _target = value;
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment