PageRenderTime 22ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/Demo/Default.aspx

http://izwebfilemanager.googlecode.com/
ASP.NET | 100 lines | 87 code | 13 blank | 0 comment | 3 complexity | eb4deaeee1f5538d22f29a8b778e9677 MD5 | raw file
  1<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
  2
  3<%@ Import Namespace="System.Reflection" %>
  4<%@ Register Assembly="IZ.WebFileManager" Namespace="IZ.WebFileManager" TagPrefix="iz" %>
  5
  6<script runat="server">
  7	class TagedCheckBox : CheckBox
  8	{
  9		object _tag;
 10		public object Tag {
 11			get { return _tag; }
 12		}
 13
 14		public TagedCheckBox (object tag) {
 15			_tag = tag;
 16			AutoPostBack = true;
 17			Checked = true;
 18		}
 19	}
 20
 21	protected override void OnInit (EventArgs e) {
 22		base.OnInit (e);
 23
 24		foreach (PropertyInfo prop in typeof (ToolbarOptions).GetProperties ()) {
 25			if (prop.PropertyType == typeof (bool)) {
 26				TagedCheckBox check = new TagedCheckBox (prop);
 27				check.Text = prop.Name.Substring (4, prop.Name.Length - 10);
 28				check.CheckedChanged += new EventHandler (TagedCheckBox_CheckedChanged);
 29				PlaceHolder1.Controls.Add (check);
 30			}
 31		}
 32	}
 33
 34	protected void DropDownList1_SelectedIndexChanged (object sender, EventArgs e) {
 35		System.Globalization.CultureInfo culture = null;
 36		if (DropDownList1.SelectedValue.Length > 0)
 37			culture = new System.Globalization.CultureInfo (DropDownList1.SelectedValue);
 38		FileManager1.Culture = culture;
 39
 40	}
 41
 42	protected void TagedCheckBox_CheckedChanged (object sender, EventArgs e) {
 43		TagedCheckBox check = (TagedCheckBox) sender;
 44		PropertyInfo prop = (PropertyInfo) check.Tag;
 45		prop.SetValue (FileManager1.ToolbarOptions, check.Checked, null);
 46	}
 47
 48	protected void CheckBox1_CheckedChanged (object sender, EventArgs e) {
 49		FileManager1.ShowToolBar = ((CheckBox) sender).Checked;
 50	}
 51
 52	protected void CheckBox2_CheckedChanged (object sender, EventArgs e) {
 53		FileManager1.ShowAddressBar = ((CheckBox) sender).Checked;
 54	}
 55
 56	protected void CheckBox3_CheckedChanged (object sender, EventArgs e) {
 57		FileManager1.ShowUploadBar = ((CheckBox) sender).Checked;
 58	}
 59
 60	protected void CheckBox4_CheckedChanged (object sender, EventArgs e) {
 61		FileManager1.RootDirectories[0].ShowRootIndex = ((CheckBox) sender).Checked;
 62	}
 63</script>
 64
 65<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
 66	<div style="margin-top: 8px; margin-bottom: 8px;">
 67		Chose Language:
 68		<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
 69			<asp:ListItem>en-US</asp:ListItem>
 70			<asp:ListItem>de-DE</asp:ListItem>
 71			<asp:ListItem>es-ES</asp:ListItem>
 72			<asp:ListItem>he-IL</asp:ListItem>
 73			<asp:ListItem>it-IT</asp:ListItem>
 74			<asp:ListItem>nb-NO</asp:ListItem>
 75			<asp:ListItem>nl-NL</asp:ListItem>
 76			<asp:ListItem>ru-RU</asp:ListItem>
 77			<asp:ListItem>pt-BR</asp:ListItem>
 78			<asp:ListItem>sr-Cyrl-CS</asp:ListItem>
 79			<asp:ListItem>sr-Latn-CS</asp:ListItem>
 80			<asp:ListItem>sv-se</asp:ListItem>
 81			<asp:ListItem>tr-TR</asp:ListItem>
 82		</asp:DropDownList>&nbsp;&nbsp;
 83		<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged"
 84			Checked="True" Text="Show ToolBar" />&nbsp;<asp:CheckBox ID="CheckBox2" runat="server"
 85				AutoPostBack="True" OnCheckedChanged="CheckBox2_CheckedChanged" Checked="True"
 86				Text="Show AddressBar" />&nbsp;<asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="True"
 87					OnCheckedChanged="CheckBox3_CheckedChanged" Checked="True" Text="Show UploadBar" />&nbsp;<asp:CheckBox
 88						ID="CheckBox4" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox4_CheckedChanged"
 89						Checked="True" Text="Show RootIndex" /><br />
 90		Customize Toolbar:
 91		<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
 92	</div>
 93	<div>
 94		<iz:FileManager ID="FileManager1" runat="server" Height="400" Width="600">
 95			<RootDirectories>
 96				<iz:RootDirectory DirectoryPath="~/Files/My Documents" Text="My Documents" />
 97			</RootDirectories>
 98		</iz:FileManager>
 99	</div>
100</asp:Content>