Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     oRotator = new Rotator(intProfile, dsn);
     ds       = oRotator.GetHeaders(1);
     if (ds.Tables[0].Rows.Count > 0)
     {
         StringBuilder sb = new StringBuilder();
         sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Advertisements>");
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             sb.Append("<Ad>");
             sb.Append("<ImageUrl><![CDATA[" + dr["imageurl"].ToString() + "]]></ImageUrl>");
             sb.Append("<Impressions>" + dr["impressions"].ToString() + "</Impressions>");
             sb.Append("</Ad>");
         }
         sb.Append("</Advertisements>");
         XmlTextReader xtr = new XmlTextReader(sb.ToString(), XmlNodeType.Document, null);
         xtr.ReadOuterXml();
         DataSet dsNew = new DataSet();
         dsNew.ReadXml(xtr);
         adRotator.DataSource = dsNew;
         adRotator.DataBind();
     }
     else
     {
         adRotator.Visible = false;
     }
 }
Пример #2
0
        private void LoopRepeater()
        {
            DataSet  ds = oRotator.GetHeaders(0);
            DataView dv = ds.Tables[0].DefaultView;

            if (Request.QueryString["sort"] != null)
            {
                dv.Sort = Request.QueryString["sort"].ToString();
            }
            rptView.DataSource = dv;
            rptView.DataBind();
            foreach (RepeaterItem ri in rptView.Items)
            {
                ImageButton oDelete = (ImageButton)ri.FindControl("btnDelete");
                oDelete.Attributes.Add("onClick", "return confirm('Are you sure you want to delete this item?');");
                ImageButton oEnable = (ImageButton)ri.FindControl("btnEnable");
                if (oEnable.ImageUrl == "images/enabled.gif")
                {
                    oEnable.ToolTip = "Click to disable";
                    oEnable.Attributes.Add("onClick", "return confirm('Are you sure you want to disable this item?');");
                }
                else
                {
                    oEnable.ToolTip = "Click to enable";
                }
            }
        }