using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using Digita.Tustena.Base; using Digita.Tustena.Core; using Digita.Tustena.Database; using Digita.Tustena.WebControls; namespace Digita.Tustena.today { public partial class MyTodayModule : GUserControl, IToday { public string ResourceText { get { return "moduletxt01"; } } public string ClientId { get { return "mymodule"; } } public bool EnablePaging { get { return true; } } public bool isEnable(string controls) { return controls.Contains(ClientId); } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //Inizializza controllo } } protected override void OnInit(EventArgs e) { base.OnInit(e); MyModuleRepeater.ItemCommand += new RepeaterCommandEventHandler(MyModuleRepeater_ItemCommand); MyModuleRepeater.ItemDataBound += new RepeaterItemEventHandler(MyModuleRepeater_ItemDataBound); } void MyModuleRepeater_ItemCommand(object source, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "DoSomething": // Do Something break; } } void MyModuleRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { switch (e.Item.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: // Do Binding break; } } protected override void OnLoad(EventArgs e) { base.OnLoad(e); } }
IToday
ResourceText
ClientId
EnablePaging
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Gazzetta.ascx.cs" Inherits="today_Gazzetta" %> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" class="pageTitle" valign="top"> Gazzetta </td> </tr> <tr> <td> <asp:Repeater runat="server" ID="GazzettaFeed"> <HeaderTemplate> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="TableHlip TodayBlackLine"> <tr> <th class="GridTitle"> Titolo Notizia </th> </HeaderTemplate> <ItemTemplate> <tr class="GridItem"> <td> <asp:Literal ID="GazzettaItem" runat="server"></asp:Literal> </td> </tr> </ItemTemplate> <AlternatingItemTemplate> <tr class="GridItemAltern"> <td> <asp:Literal ID="GazzettaItem" runat="server"></asp:Literal> </td> </tr> </AlternatingItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> </td> </tr> </table>
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Digita.Tustena.Base; using System.Net; using System.Xml; using System.IO; public partial class today_Gazzetta : GUserControl, IToday { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { WebClient wc = new WebClient(); byte[] data = wc.DownloadData("http://www.gazzetta.it/rss/Calcio.xml"); MemoryStream ms = new MemoryStream(data); XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(ms); GazzettaFeed.DataSource = xmldoc.SelectNodes("/rss/channel/item[position()<6]"); GazzettaFeed.DataBind(); } } protected override void OnInit(EventArgs e) { base.OnInit(e); GazzettaFeed.ItemDataBound += new RepeaterItemEventHandler(GazzettaFeed_ItemDataBound); } void GazzettaFeed_ItemDataBound(object sender, RepeaterItemEventArgs e) { switch (e.Item.ItemType) { case ListItemType.AlternatingItem: case ListItemType.Item: Literal GazzettaItem = (Literal)e.Item.FindControl("GazzettaItem"); XmlNode xmln = (XmlNode)e.Item.DataItem; GazzettaItem.Text = string.Format("<a target=\"_blank\" href=\"{0}\">{1}</a>", xmln.SelectSingleNode("link").InnerText, xmln.SelectSingleNode("title").InnerText); break; } } #region IToday Membri di public string ClientId { get { return "GazzettaFeed"; } } public bool EnablePaging { get { return false; } } public string ResourceText { get { return "Gazzetta"; } } public bool isEnable(string controls) { return true; } #endregion }