Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="_default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Text Box: <asp:TextBox runat="server" ID="textBox1" /><br />
<asp:Repeater runat="server" ID="repeater1" OnItemDataBound="OnItemDataBound_Repeater1">
<ItemTemplate>
<asp:Label runat="server" ID="label1" Text="<%# Container.DataItem %>" />
<asp:Repeater runat="server" ID="innerRepeater1" OnItemDataBound="OnItemDataBound_InnerRepeater1">
<ItemTemplate>
<blockquote><asp:Label runat="server" ID="innerLabel1" Text="<%# Container.DataItem %>" /></blockquote>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:Repeater>
</div>
<div>Log:</div>
<%= AppDomain.CurrentDomain.GetData ("BEGIN_CODE_MARKER") %><pre runat="server" id="log"></pre><%= AppDomain.CurrentDomain.GetData ("END_CODE_MARKER") %>
</form>
</body>
</html>

View File

@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _default : System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
var list = new List<string> {
"One",
"Two",
"Three"
};
try {
GetUniqueIDRelativeTo (null);
} catch (ArgumentNullException ex) {
log.InnerText += String.Format ("Page; Relative to: null; Result: exception {0} (expected)\n", ex.GetType ());
} catch (Exception ex) {
log.InnerText += String.Format ("Page; Relative to: null; Result: exception {0}\n", ex.GetType ());
}
var ctl = new Control ();
try {
ctl.GetUniqueIDRelativeTo (this);
} catch (InvalidOperationException ex) {
log.InnerText += String.Format ("A control; Relative to: {0}; Result: exception {1} (expected)\n", this.UniqueID, ex.GetType ());
} catch (Exception ex) {
log.InnerText += String.Format ("A control; Relative to: {0}; Result: exception {1}\n", this.UniqueID, ex.GetType ());
}
try {
textBox1.GetUniqueIDRelativeTo (this);
} catch (InvalidOperationException ex) {
log.InnerText += String.Format ("TextBox; Relative to: {0}; Result: exception {1} (expected)\n", this.UniqueID, ex.GetType ());
} catch (Exception ex) {
log.InnerText += String.Format ("TextBox; Relative to: {0}; Result: exception {1}\n", this.UniqueID, ex.GetType ());
}
repeater1.DataSource = list;
repeater1.DataBind ();
}
protected void OnItemDataBound_Repeater1 (object sender, RepeaterItemEventArgs args)
{
if (args.Item.ItemType == ListItemType.Separator)
return;
int index = args.Item.ItemIndex;
var sb = new StringBuilder ();
Label label = args.Item.FindControl ("label1") as Label;
string id = label.GetUniqueIDRelativeTo (args.Item);
LogItem (index, label, args.Item, sb);
id = label.GetUniqueIDRelativeTo (repeater1);
LogItem (index, label, repeater1, sb);
try {
id = label.GetUniqueIDRelativeTo (this);
} catch (InvalidOperationException ex) {
sb.AppendFormat ("Item: {0}; Relative to: {1}; Result: exception {2} (expected)\n", args.Item.ItemIndex, this.UniqueID, ex.GetType ());
} catch (Exception ex) {
sb.AppendFormat ("Item: {0}; Relative to: {1}; Result: exception {2}\n", args.Item.ItemIndex, this.UniqueID, ex.GetType ());
}
log.InnerText += sb.ToString ();
int listStart = index * 3;
var list = new List<int> {
listStart,
listStart + 1,
listStart + 2
};
Repeater innerRepeater = args.Item.FindControl ("innerRepeater1") as Repeater;
innerRepeater.DataSource = list;
innerRepeater.DataBind ();
}
protected void OnItemDataBound_InnerRepeater1 (object sender, RepeaterItemEventArgs args)
{
if (args.Item.ItemType == ListItemType.Separator)
return;
int index = args.Item.ItemIndex;
var sb = new StringBuilder ();
Label label = args.Item.FindControl ("innerLabel1") as Label;
string id = label.GetUniqueIDRelativeTo (args.Item);
LogItem (index, label, args.Item, sb, "\t");
id = label.GetUniqueIDRelativeTo (repeater1);
LogItem (index, label, repeater1, sb, "\t");
id = label.GetUniqueIDRelativeTo (args.Item.Parent);
LogItem (index, label, args.Item.Parent, sb, "\t");
try {
id = label.GetUniqueIDRelativeTo (this);
} catch (InvalidOperationException ex) {
sb.AppendFormat ("\tItem: {0}; Relative to: {1}; Result: exception {2} (expected)\n", args.Item.ItemIndex, this.UniqueID, ex.GetType ());
} catch (Exception ex) {
sb.AppendFormat ("\tItem: {0}; Relative to: {1}; Result: exception {2}\n", args.Item.ItemIndex, this.UniqueID, ex.GetType ());
}
log.InnerText += sb.ToString ();
}
void LogItem (int index, Control ctl, Control relativeTo, StringBuilder sb, string indent = "")
{
string id = ctl.GetUniqueIDRelativeTo (relativeTo);
sb.AppendFormat ("{0}Item: {1}; Relative to: {2}; Result: '{3}'\n", indent, index, relativeTo.UniqueID, id);
}
}

View File

@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>