Anda di halaman 1dari 27

Skin Chooser

Black

Brick

Classic

ClassicBlue

ClassicGold

Default

Default2006

Electric

Inox

Mac

Office2007

Outlook

Rtl

Telerik

Vista

VSNET

Web20

WebBlue

WindowsGray

WindowsOlive

WindowsXP

WindowsXP_Rtl

using using using using using using

System; System.Collections; System.IO; System.Web.UI.WebControls; Telerik.QuickStart; Telerik.WebControls;

namespace Telerik.ComboboxExamplesCS.Skinning { /// <summary> /// Summary description for _Default. /// </summary> public partial class DefaultCS: XhtmlPage { protected System.Web.UI.WebControls.RadioButtonList SkinChooser;

private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { string skinsFolder = Server.MapPath(RadComboBox1.SkinsPath); DirectoryInfo skinsDirectory = new DirectoryInfo(skinsFolder); ArrayList skins = new ArrayList(); foreach (DirectoryInfo skin in skinsDirectory.GetDirectories()) { if (!skin.Name.ToLower().StartsWith("vertical") && skin.Name != "DifferentTabs" ) { skins.Add(skin); } } RadioButtonList1.DataSource = skins; RadioButtonList1.DataBind(); ListItem selected = RadioButtonList1.Items.FindByValue(RadComboBox1.Skin); selected.Selected = true; } } RadComboBox1.RadComboBoxImagePosition = RadComboBoxImagePosition.Right;

private void DefaultCS_PreRender(object sender, EventArgs e) { foreach (ListItem item in RadioButtonList1.Items) { item.Text = string.Format("<img src='thumbnails/{0}.gif' alt='' onclick='this.parentNode.click();'/> {0}", item.Value); } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.RadioButtonList1.SelectedIndexChanged += new System.EventHandler(this.RadioButtonList1_SelectedIndexChanged);

this.Load += new System.EventHandler(this.Page_Load); this.PreRender += new System.EventHandler(this.DefaultCS_PreRender); } #endregion private void RadioButtonList1_SelectedIndexChanged(object sender, System.EventArgs e) { RadComboBox1.Skin = RadioButtonList1.Items[RadioButtonList1.SelectedIndex].Value; if (RadComboBox1.Skin=="Rtl") { RadComboBox1.RadComboBoxImagePosition = RadComboBoxImagePosition.Left; } } } }

<%@ Page AutoEventWireup="false" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.ComboboxExamplesCS.Skinning.DefaultCS" Language="c#" %> <%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" Assembly="Telerik.QuickStart" %> <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %> <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %> <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %> <%@ Register TagPrefix="rad" Namespace="Telerik.WebControls" Assembly="RadComboBox.NET2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <telerik:HeadTag runat="server" ID="Headtag1"></telerik:HeadTag> <!-- custom head section --> <style type="text/css"> label { } </style> <!-- end of custom head section --> </head> <body class="BODY"> <form runat="server" id="mainForm" method="post" style="width:100%;"> <telerik:Header runat="server" ID="Header1" NavigationLanguage="C#"></telerik:Header> <!-- content start --> <rad:radcombobox id="RadComboBox1" Runat="server" Height="140px" ShowToggleImage="True" Sort="Ascending" Skin="Classic" RadComboBoxImagePosition="Right" ContentFile="~/Combobox/Examples/Functionality/Skinning/combobox.xml"></rad:radcombobox> <div class="module" style="margin-top: 20px;margin-right:11px;"> <div style="FONT-WEIGHT: bold; MARGIN-BOTTOM: 20px; CURSOR: default; COLOR: #333333; BORDER-BOTTOM: #333333 1px solid">Skin Chooser</div> <asp:RadioButtonList id="RadioButtonList1" runat="server" RepeatColumns="2" AutoPostBack="True" Width="100%" RepeatDirection="Horizontal" DataValueField="Name"> </asp:RadioButtonList> </div> <br/> <div class="module" style="margin-right:11px;"> <div style="FONT-WEIGHT: bold; MARGIN-BOTTOM: 20px; CURSOR: default; COLOR: #333333; BORDER-BOTTOM: #333333 1px solid">Skin Resources</div> <img src="../../../../Img/photoshop.gif" height="21" width="21" alt="Photoshop source files" style="vertical-align:middle;margin-right: 11px;" /> Photoshop source files available for selected skins at <a href="http://www.telerik.com/skins">http://www.telerik.com/skins</a> <br /><br /> <img src="../../../../Img/SkinTutorial.gif" height="21" width="21" alt="Getting started with telerik skinning" style="vertical-align:middle;margin-right: 11px;" /> Tutorial: Getting started with <b>t</b>elerik skinning at <a href="http://www.telerik.com/documents/SkinningTutorial.pdf">http://www.telerik.com/docum ents/SkinningTutorial.pdf</a> </div> <!-- content end --> <telerik:Footer runat="server" ID="Footer1"></telerik:Footer> </form> </body> </html>

COOL COMBO using using using using using using using using using using using System; System.Collections; System.ComponentModel; System.Data; System.Data.OleDb; System.Drawing; System.Web; System.Web.SessionState; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.HtmlControls;

namespace Telerik.AJAXExamplesCSharp.AJAX.Examples.Functionality.SettingFocus { /// <summary> /// Summary description for DefaultCS. /// </summary> public partial class DefaultCS : Telerik.QuickStart.XhtmlPage {

private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { LoadContinents(); ResetControls(); } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.ddlContinents.SelectedIndexChanged += new System.EventHandler(this.ddlContinents_SelectedIndexChanged); this.ddlCountries.SelectedIndexChanged += new System.EventHandler(this.ddlCountries_SelectedIndexChanged); this.ddlCities.SelectedIndexChanged += new System.EventHandler(this.ddlCities_SelectedIndexChanged); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void LoadContinents() { string path = Server.MapPath("~/AJAX/Data/Countries.mdb"); OleDbConnection dbCon = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path);

dbCon.Open(); dbCon); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Continents", DataTable dt = new DataTable(); adapter.Fill(dt); dbCon.Close(); ddlContinents.DataTextField = "Name"; ddlContinents.DataValueField = "ID"; ddlContinents.DataSource = dt; ddlContinents.DataBind(); ddlContinents.Items.Insert(0, new ListItem(" - Select a continent - ")); if (ddlContinents.SelectedIndex == -1) { ddlContinents.SelectedIndex = 0; }

private void ResetControls() { if (ddlCountries.Items.Count == 0) { ddlCountries.Items.Insert(0, new ListItem("- Select a country - ", "-1")); } ddlCities.SelectedIndex = 0; if (ddlCities.Items.Count == 0) { ddlCities.Items.Insert(0, new ListItem("- Select a city - ", "-1")); } ddlCities.SelectedIndex = 0; } private void LoadCountries(string selectedValue) { if (selectedValue != "-1") { string path = Server.MapPath("~/AJAX/Data/Countries.mdb"); OleDbConnection dbCon = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path); dbCon.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Countries WHERE ContinentID = " + selectedValue, dbCon); DataTable dt = new DataTable(); adapter.Fill(dt); dbCon.Close(); ddlCountries.DataTextField = "Name"; ddlCountries.DataValueField = "ID"; ddlCountries.DataSource = dt; ddlCountries.DataBind(); ddlCountries.Enabled = true; ddlCountries.Items.Insert(0, new ListItem("- Select a country -", "-1")); if (ddlCountries.SelectedIndex == -1) { ddlCountries.SelectedIndex = 0; }

} }

private void LoadCities(string selectedValue) { if (selectedValue != "-1") { string path = Server.MapPath("~/AJAX/Data/Countries.mdb");

OleDbConnection dbCon = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path); dbCon.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Cities WHERE CountryID = " + selectedValue, dbCon); DataTable dt = new DataTable(); adapter.Fill(dt); dbCon.Close(); ddlCities.DataTextField = "Name"; ddlCities.DataValueField = "ID"; ddlCities.DataSource = dt; ddlCities.DataBind(); ddlCities.Items.Insert(0, new ListItem("- Select a city - ", "-1")); ddlCities.Enabled = true; if (ddlCities.SelectedIndex == -1) { ddlCities.SelectedIndex = 0; }

} else { if (ddlCities.Items.Count == 0) { ddlCities.Items.Insert(0, new ListItem("- Select a city - ", "-1")); } ddlCities.SelectedIndex = 0; ddlCities.Enabled = false; }

private void UpdatePath() { lbPath.Text = string.Empty; if (ddlContinents.SelectedIndex > 0) { lbPath.Text += ddlContinents.SelectedItem.Text; if (ddlCountries.SelectedIndex > 0) { lbPath.Text += " > " + ddlCountries.SelectedItem.Text; if (ddlCities.SelectedIndex > 0) { lbPath.Text += " > " + ddlCities.SelectedItem.Text; }

} } }

private void ddlContinents_SelectedIndexChanged(object sender, System.EventArgs e) { if (ddlContinents.SelectedIndex > 0) { LoadCountries(ddlContinents.SelectedItem.Value); LoadCities(ddlCountries.SelectedItem.Value); if (cbSetFocus.Checked) { RadAjaxManager1.FocusControl(ddlCountries.ClientID); } } else { ddlCountries.Enabled = false; ddlCities.Enabled = false; ResetControls(); } UpdatePath();

} private void ddlCountries_SelectedIndexChanged(object sender, System.EventArgs e) { if (ddlCountries.SelectedIndex > 0) { LoadCities(ddlCountries.SelectedItem.Value); if (cbSetFocus.Checked) { RadAjaxManager1.FocusControl(ddlCities.ClientID); } } UpdatePath(); } private void ddlCities_SelectedIndexChanged(object sender, System.EventArgs e) { UpdatePath(); if (cbSetFocus.Checked) { RadAjaxManager1.FocusControl(ddlContinents.ClientID); } } } }

<%@ Page language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="false" Inherits="Telerik.AJAXExamplesCSharp.AJAX.Examples.Functionality.SettingFocus.DefaultCS" %> <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %> <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %> <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %> <%@ Register TagPrefix="rad" Namespace="Telerik.WebControls" Assembly="RadAjax.NET2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head runat="server"> <telerik:HeadTag runat="server" ID="Headtag1"></telerik:HeadTag> <!-- custom head section --> <link href="Styles/Styles.css" type="text/css" rel="stylesheet" /> <!-- end of custom head section --> </head> <body class="BODY"> <form runat="server"> <telerik:Header runat="server" ID="Header1" NavigationLanguage="CS"></telerik:Header> <!-- content start --> <rad:RadAjaxManager id="RadAjaxManager1" runat="server"> <AjaxSettings> <rad:AjaxSetting AjaxControlID="ddlContinents"> <UpdatedControls> <rad:AjaxUpdatedControl ControlID="ddlCountries" LoadingPanelID="LoadingPanel1"></rad:AjaxUpdatedControl> <rad:AjaxUpdatedControl ControlID="ddlCities" LoadingPanelID="LoadingPanel1"></rad:AjaxUpdatedControl> <rad:AjaxUpdatedControl ControlID="lbPath"></rad:AjaxUpdatedControl> </UpdatedControls> </rad:AjaxSetting> <rad:AjaxSetting AjaxControlID="ddlCountries"> <UpdatedControls> <rad:AjaxUpdatedControl ControlID="ddlCities" LoadingPanelID="LoadingPanel1"></rad:AjaxUpdatedControl> <rad:AjaxUpdatedControl ControlID="lbPath"></rad:AjaxUpdatedControl> </UpdatedControls> </rad:AjaxSetting> <rad:AjaxSetting AjaxControlID="ddlCities"> <UpdatedControls> <rad:AjaxUpdatedControl ControlID="lbPath"></rad:AjaxUpdatedControl> </UpdatedControls> </rad:AjaxSetting> </AjaxSettings> </rad:RadAjaxManager> <div class="panelTop"></div> <div class="panelContent"> <img src="Images/FindAPlace.gif" height="59" width="332" alt="FindAPlace" /> <div class="comboPanel"> <asp:DropDownList ID="ddlContinents" Runat="server" Width="200px" AutoPostBack="True"> <asp:ListItem Value="Item 1">Item 1</asp:ListItem> <asp:ListItem Value="Item 2">Item 2</asp:ListItem> <asp:ListItem Value="Item 3">Item 3</asp:ListItem> </asp:DropDownList> </div> <div class="panelSeparator"></div> <div class="comboPanel"> <asp:DropDownList id="ddlCountries" Runat="server" Width="200px" Enabled="False" AutoPostBack="True"></asp:DropDownList> </div> <div class="panelSeparator"></div> <div class="comboPanel"> <asp:DropDownList ID="ddlCities" Runat="server" Width="200px" Enabled="False" AutoPostBack="True"></asp:DropDownList> </div>

<div class="panelSeparator"></div> <div class="infoPanel"> <div> <asp:Label id="lbPath" runat="server"></asp:Label> </div> </div> <div class="setCustomFocus"> <asp:CheckBox ID="cbSetFocus" Runat="server" Text="Set Custom Focus" Checked="True" Width="170px" Height="22px" AutoPostBack="True"></asp:CheckBox> </div> </div> <div class="panelBottom"> <rad:AjaxLoadingPanel id="LoadingPanel1" height="77px" width="113px" Runat="server"> <asp:Image id="Image1" runat="server" ImageUrl="~/RadControls/AJAX/Skins/Default/loading7.gif" AlternateText="loading" BorderWidth="0px"></asp:Image> </rad:AjaxLoadingPanel> </div> <!-- content end --> <telerik:Footer runat="server" ID="Footer1"></telerik:Footer> </form> </body> </html>

using using using using using

System; System.Data; System.Data.OleDb; Telerik.QuickStart; Telerik.WebControls;

namespace Telerik.ComboboxExamplesCS.MultipleComboBoxes { public partial class DefaultCS: XhtmlPage { private void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { LoadContinents(); } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { InitializeComponent(); base.OnInit(e); } private void InitializeComponent() { this.RadComboBox1.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox1_ItemsRequeste d); this.RadComboBox2.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox2_ItemsRequeste d); this.RadComboBox3.ItemsRequested += new Telerik.WebControls.RadComboBoxItemsRequestedEventHandler(this.RadComboBox3_ItemsRequeste d); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void LoadContinents() { string path = Server.MapPath("~/Combobox/Data/Countries.mdb"); OleDbConnection dbCon = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path); dbCon.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Continents", dbCon); DataTable dt = new DataTable(); adapter.Fill(dt); dbCon.Close(); RadComboBox1.DataTextField = "Name"; RadComboBox1.DataValueField = "ID"; RadComboBox1.DataSource = dt; RadComboBox1.DataBind(); -")); RadComboBox1.Items.Insert(0, new RadComboBoxItem("- Select a continent foreach (RadComboBoxItem item in RadComboBox1.Items) { item.ToolTip = item.Text; }

private void LoadCountries(string continentID)

string path = Server.MapPath("~/Combobox/Data/Countries.mdb"); OleDbConnection dbCon = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path); dbCon.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Countries WHERE ContinentID=" + continentID, dbCon); DataTable dt = new DataTable(); adapter.Fill(dt); dbCon.Close(); RadComboBox2.DataTextField = "Name"; RadComboBox2.DataValueField = "ID"; RadComboBox2.DataSource = dt; RadComboBox2.DataBind(); foreach (RadComboBoxItem item in RadComboBox2.Items) { item.ToolTip = item.Text; }

private void LoadCities(string countryID) { string path = Server.MapPath("~/Combobox/Data/Countries.mdb"); OleDbConnection dbCon = new OleDbConnection ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path); dbCon.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Cities WHERE CountryID=" + countryID, dbCon); DataTable dt = new DataTable(); adapter.Fill(dt); dbCon.Close(); RadComboBox3.DataTextField = "Name"; RadComboBox3.DataValueField = "ID"; RadComboBox3.DataSource = dt; RadComboBox3.DataBind(); foreach (RadComboBoxItem item in RadComboBox3.Items) { item.ToolTip = item.Text; }

private void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) { LoadContinents(); } private void RadComboBox2_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) { LoadCountries(e.Text); } private void RadComboBox3_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) { LoadCities(e.Text); } } }

<?xml version="1.0" encoding="utf-8" ?> <Items> <Item Text="New York" Value="1" /> <Item Text="Paris" Value="2" /> <Item Text="London" Value="3" /> <Item Text="Oslo" Value="4" /> <Item Text="Sofia" Value="5" /> <Item Text="Liverpool" Value="6" /> <Item Text="Seattle" Value="7" /> <Item Text="San Francisco" Value="8" /> <Item Text="Boston" Value="9" /> <Item Text="Miami" Value="10" /> <Item Text="Denver" Value="11" /> <Item Text="Dallas" Value="12" /> <Item Text="Madrid" Value="13" /> <Item Text="Barcelona" Value="14" /> <Item Text="Amsterdam" Value="15" /> <Item Text="Moscow" Value="16" /> <Item Text="Brussels" Value="17" /> <Item Text="Bonn" Value="18" /> <Item Text="Dublin" Value="19" /> <Item Text="St.Paul" Value="20" /> </Items>

<%@ Register TagPrefix="rad" Namespace="Telerik.WebControls" Assembly="RadComboBox.NET2" %> <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %> <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %> <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %> <%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" Assembly="Telerik.QuickStart" %> <%@ Page AutoEventWireup="false" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.ComboboxExamplesCS.MultipleComboBoxes.DefaultCS" Language="c#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <telerik:HeadTag runat="server" ID="Headtag1"></telerik:HeadTag> <!-- custom head section --> <!-- end of custom head section --> </head> <body class="BODY"> <form runat="server" id="mainForm" method="post" style="WIDTH:100%"> <telerik:Header runat="server" ID="Header1" NavigationLanguage="C#"></telerik:Header> <div style="HEIGHT: 300px;width:500px;"> <span style="width:325px;float:left;"> <span class="text" style="height:250px;width:150px;float:left"> Select a continent:<br/> <rad:radcombobox id="RadComboBox1" Runat="server" Height="140px" Width="150px" Skin="WindowsXP" ShowToggleImage="True" OnClientSelectedIndexChanging="LoadCountries" /> </span> <span class="text" style="height:250px;width:150px;float:right"> Select a country:<br/> <rad:radcombobox id="RadComboBox2" Runat="server" Height="140px" Width="150px" Skin="WindowsXP" ShowToggleImage="True" OnClientSelectedIndexChanging="LoadCities" OnClientItemsRequested="ItemsLoaded" /> </span> </span> <span class="text" style="height:250px;width:150px;float:right"> Select a city:<br/> <rad:radcombobox id="RadComboBox3" Runat="server" Height="140px" Skin="WindowsXP" Width="150px" ShowToggleImage="True" OnClientItemsRequested="ItemsLoaded" /> </span> </div> <script type="text/javascript"> var countriesCombo = <%= RadComboBox2.ClientID %>; var citiesCombo = <%= RadComboBox3.ClientID %>; function LoadCountries(item) { countriesCombo.SetText("Loading..."); citiesCombo.ClearSelection();

false);

if (item.Index > 0) { countriesCombo.RequestItems(item.Value, } else { countriesCombo.Items = []; countriesCombo.SetText(" "); countriesCombo.ClearItems(); citiesCombo.Items = []; citiesCombo.SetText(" "); citiesCombo.ClearItems(); } }

function LoadCities(item) { citiesCombo.SetText("Loading..."); citiesCombo.RequestItems(item.Value, false); } function ItemsLoaded(combo) { if (combo.Items.length > 0) { combo.SetText(combo.Items[0].Text); combo.Items[0].Highlight(); } combo.ShowDropDown(); } </script> <!-- content end --> <telerik:Footer runat="server" ID="Footer1"></telerik:Footer> </form> </body> </html>

FAST NAVIGATION _ CALENDAR using using using using using using using using using using System; System.Collections; System.ComponentModel; System.Data; System.Drawing; System.Web; System.Web.SessionState; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.HtmlControls;

namespace Telerik.ExamplesCSharp.RadCalendar.Functionality.FastNavigation { public partial class DefaultCS : Telerik.QuickStart.XhtmlPage { protected System.Web.UI.WebControls.Image Image1; protected System.Web.UI.WebControls.Image Image2; private void Page_Load(object sender, System.EventArgs e) { } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { InitializeComponent(); base.OnInit(e); } private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion protected void EnableFastNavigationCheckBox_CheckedChanged(object sender, EventArgs e) { RadCalendar1.EnableMonthYearFastNavigation = ! RadCalendar1.EnableMonthYearFastNavigation; } protected void EnableTodaySelectionCheckBox_CheckedChanged(object sender, EventArgs e) { RadCalendar1.FastNavigationSettings.EnableTodayButtonSelection = ! RadCalendar1.FastNavigationSettings.EnableTodayButtonSelection; } } }

<%@ Register TagPrefix="rad" Namespace="Telerik.WebControls" Assembly="RadCalendar.NET2" %> <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %> <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %> <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %> <%@ Page CodeFile="DefaultCS.aspx.cs" Language="c#" AutoEventWireup="false" Inherits="Telerik.ExamplesCSharp.RadCalendar.Functionality.FastNavigation.DefaultCS" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <telerik:headtag runat="server" id="Headtag1"></telerik:headtag> </head> <body class="BODY"> <form runat="server" id="mainForm" method="post" style="WIDTH:100%"> <telerik:header id="Header1" runat="server" navigationlanguage="CS"></telerik:header> <table summary="Fast Date Navigation Example"> <tr> <td style="vertical-align:top;padding-right:20px;"> <rad:radcalendar id="RadCalendar1" runat="server" DayNameFormat="FirstLetter" Skin="Outlook"> </rad:radcalendar> <br /> <asp:CheckBox ID="EnableFastNavigationCheckBox" runat="server" Text="Fast Navigation Enabled" Checked="True" AutoPostBack="True" OnCheckedChanged="EnableFastNavigationCheckBox_CheckedChanged"></asp:CheckBox> <br /> <asp:CheckBox ID="EnableTodaySelectionCheckBox" runat="server" Text="Fast Navigation Today Button Selection Enabled" Checked="false" AutoPostBack="true" OnCheckedChanged="EnableTodaySelectionCheckBox_CheckedChanged" /> </td> <td style="vertical-align:top;"> <div class="module"> Click on the month to open a shortcut for fast navigation<br/><br/> <img src="Img/Step1.jpg" alt="" /> </div> </td> </tr> </table> <br /> <telerik:footer id="Footer1" runat="server"></telerik:footer> </form> </body> </html>

GOBALIZATION CALENDAR using using using using using using using using using using using System; System.Collections; System.ComponentModel; System.Data; System.Drawing; System.Globalization; System.Web; System.Web.SessionState; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.HtmlControls;

namespace Telerik.ExamplesCSharp.RadCalendar.Functionality.Globalization { /// <summary> /// Summary description for DefaultCS. /// </summary> public partial class DefaultCS : Telerik.QuickStart.XhtmlPage { protected Telerik.WebControls.RadCalendar calendar1;

private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { SortedList cultures = new SortedList(); CultureInfo ci; for(int i=0; i< CultureInfo.GetCultures(CultureTypes.SpecificCultures).Length; i++) { ci = CultureInfo.GetCultures(CultureTypes.SpecificCultures)[i]; cultures.Add(ci.EnglishName, ci.Name); } IEnumerator ie = cultures.Keys.GetEnumerator(); while(ie.MoveNext()) { string name = (string)ie.Current; CulturesList.Items.Add(new ListItem(name, cultures[name].ToString())); } RadCalendar1.CultureInfo = CultureInfo.CurrentCulture; CulturesList.SelectedIndex = CulturesList.Items.IndexOf(CulturesList.Items.FindByText(CultureInfo.CurrentCulture.Engli shName)); } } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// /// /// <summary> Required method for Designer support - do not modify the contents of this method with the code editor. </summary>

private void InitializeComponent() { this.CulturesList.SelectedIndexChanged += new System.EventHandler(this.CulturesList_SelectedIndexChanged); this.BtnSet.Click += new System.EventHandler(this.BtnSet_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void CulturesList_SelectedIndexChanged(object sender, System.EventArgs e) { RadCalendar1.CultureInfo = new CultureInfo(CulturesList.Items[CulturesList.SelectedIndex].Value); } protected void BtnSet_Click(object sender, System.EventArgs e) { RadCalendar1.FastNavigationSettings.CancelButtonCaption = CancelTB.Text; RadCalendar1.FastNavigationSettings.OkButtonCaption = OkTB.Text; RadCalendar1.FastNavigationSettings.TodayButtonCaption = TodayTB.Text; } } }

<%@ Page CodeFile="DefaultCS.aspx.cs" Language="c#" AutoEventWireup="false" Inherits="Telerik.ExamplesCSharp.RadCalendar.Functionality.Globalization.DefaultCS" %> <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %> <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %> <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %> <%@ Register TagPrefix="rad" Namespace="Telerik.WebControls" Assembly="RadCalendar.NET2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <telerik:HeadTag runat="server" ID="Headtag1"></telerik:HeadTag> </head> <body class="BODY"> <form runat="server" id="mainForm" method="post" style="WIDTH:100%"> <telerik:Header id="Header1" runat="server" NavigationLanguage="CS"></telerik:Header> border="0"> <table id="Table1" cellspacing="0" cellpadding="0" width="90%"

<tr> <td style="width: 50%;"> <rad:radcalendar id="RadCalendar1" runat="server" TitleFormat="MMMM yyyy" Skin="Telerik" DayNameFormat="Short"> </rad:radcalendar> </td> <td valign="middle" class="module" > <br /> Select culture: <br /> <br /> <label for="CulturesList"></label> <asp:DropDownList ID="CulturesList" Runat="server" AutoPostBack="True" width="220"></asp:DropDownList> <br /><br /><br /><br /><br /> Type a specific text to set the text of the fast navigation buttons: <br /> <br /> <asp:TextBox ID="TodayTB" Runat="server" Text="Today" Width="80px"></asp:TextBox> <asp:TextBox ID="OkTB" Runat="server" Text="OK" Width="80px"></asp:TextBox> <asp:TextBox ID="CancelTB" Runat="server" Text="Cancel" Width="80px"></asp:TextBox><br /><br /><br /> <asp:Button ID="BtnSet" Runat="server" class="button" Text="Change FastNavigation buttons text" Width="250px" OnClick="BtnSet_Click"></asp:Button> </td> </tr> </table> <telerik:Footer id="Footer1" runat="server"></telerik:Footer> </form> </body> </html>

SKIN

Black

Business

Default

Default2006

Inox

Mac

Modern

Office2007

Orange

Outlook

Pink

Stylish

Sunny

Telerik

Vista

Web20

WebBlue

using using using using using using using using using using

System; System.Collections; System.ComponentModel; System.Data; System.Drawing; System.Web; System.Web.SessionState; System.Web.UI; System.Web.UI.WebControls; System.Web.UI.HtmlControls;

using Telerik.QuickStart; using System.IO; namespace Telerik.ExamplesCSharp.RadCalendar.Functionality.Skins { /// <summary> /// Summary description for DefaultCS. /// </summary> public partial class DefaultCS : Telerik.QuickStart.XhtmlPage {

private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { string skinsFolder = Server.MapPath(RadCalendar1.SkinsPath); DirectoryInfo skinsDirectory = new DirectoryInfo(skinsFolder); ArrayList skins = new ArrayList(); foreach (DirectoryInfo skin in skinsDirectory.GetDirectories()) { skins.Add(skin); } RadioButtonList1.DataSource = skins; RadioButtonList1.DataBind(); ListItem selected = RadioButtonList1.Items.FindByValue(RadCalendar1.Skin); selected.Selected = true;

} }

#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.RadioButtonList1.SelectedIndexChanged += new System.EventHandler(this.RadioButtonList1_SelectedIndexChanged); this.Load += new System.EventHandler(this.Page_Load); this.PreRender +=new EventHandler(this.Page_PreRender); } #endregion protected void RadioButtonList1_SelectedIndexChanged(object sender,

System.EventArgs e) { RadCalendar1.Skin = RadioButtonList1.Items[RadioButtonList1.SelectedIndex].Value; } private void Page_PreRender(object sender, EventArgs e) { foreach (ListItem item in RadioButtonList1.Items) { item.Text = string.Format("<img src='thumbnails/{0}.gif' alt='thumbnail' onclick='this.parentNode.click();'/> {0}", item.Value); } } } }

<%@ Page language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="false" Inherits="Telerik.ExamplesCSharp.RadCalendar.Functionality.Skins.DefaultCS" %> <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %> <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %> <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %> <%@ Register TagPrefix="rad" Namespace="Telerik.WebControls" Assembly="RadCalendar.NET2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head runat="server"> <telerik:HeadTag runat="server" ID="Headtag1"></telerik:HeadTag> </head> <body class="body"> <form runat="server" id="mainForm" method="post" style="WIDTH:100%"> <telerik:Header id="Header1" runat="server" NavigationLanguage="CS"></telerik:Header> <rad:RadCalendar ID="RadCalendar1" runat="server" Skin="Default" TitleFormat="MMMM yyyy"></rad:RadCalendar> <div class="module" style="CLEAR: both; PADDING-BOTTOM: 20px; WIDTH: 700px"> <div style="FONT-WEIGHT: bold; MARGIN-BOTTOM: 20px; CURSOR: default; COLOR: #333333; BORDER-BOTTOM: #333333 1px solid"> Skin Chooser</div> <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatColumns="3" AutoPostBack="True" RepeatDirection="Horizontal" DataValueField="Name" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"></asp:RadioButtonList> </div> <br /> <div class="module" style="MARGIN-RIGHT:11px"> <div style="FONT-WEIGHT: bold; MARGIN-BOTTOM: 20px; CURSOR: default; COLOR: #333333; BORDER-BOTTOM: #333333 1px solid">Skin Resources</div> <img src="../../../../Img/photoshop.gif" height="21" width="21" alt="Photoshop source files" style="VERTICAL-ALIGN:middle;MARGIN-RIGHT:11px" /> Photoshop source files available for selected skins at <a href="http://www.telerik.com/skins">http://www.telerik.com/skins</a> <br /> <br /> <img src="../../../../Img/SkinTutorial.gif" height="21" width="21" alt="Getting started with telerik skinning" style="VERTICAL-ALIGN:middle;MARGIN-RIGHT:11px" /> Tutorial: Getting started with <b>t</b>elerik skinning at <a href="http://www.telerik.com/documents/SkinningTutorial.pdf"> http://www.telerik.com/documents/SkinningTutorial.pdf</a> </div> <telerik:Footer id="Footer1" runat="server"></telerik:Footer> </form> </body> </html>

Anda mungkin juga menyukai