<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Head.SmackOnTable(); &#187; NetTiers</title>
	<atom:link href="http://www.unauthorised-access.com/category/nettiers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unauthorised-access.com</link>
	<description>Contains Nuts.</description>
	<lastBuildDate>Fri, 02 Jul 2010 17:46:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Deeploading with NetTiers</title>
		<link>http://www.unauthorised-access.com/2009/12/deeploading-with-nettiers/</link>
		<comments>http://www.unauthorised-access.com/2009/12/deeploading-with-nettiers/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 15:40:23 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[NetTiers]]></category>
		<category><![CDATA[c#.net]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=357</guid>
		<description><![CDATA[Once you get your head around the DeepLoading and Inclusive/Exclusive Lists in NetTiers, its not too hard, but it isnt straightforward to start off with. Take this VERY simplified class, as an example: class Product { public TList&#60;Product&#62; ChildrenProducts {get;set;} public Product ParentProduct {get;set;} } If you want to deepload the ChildrenProducts collection, you think [...]]]></description>
			<content:encoded><![CDATA[<p>Once you get your head around the DeepLoading and Inclusive/Exclusive Lists in NetTiers, its not too hard, but it isnt straightforward to start off with. Take this VERY simplified class, as an example:</p>
<pre class="brush: csharp;">

class Product
{
public TList&lt;Product&gt; ChildrenProducts {get;set;}
public Product ParentProduct {get;set;}
}
</pre>
<p>If you want to deepload the ChildrenProducts collection, you think youd run the following:</p>
<pre class="brush: csharp;">

DataRepository.ProductProvider.DeepLoad(product,true,DeepLoadType.IncludeChildren, new []{typeof(Product)});
</pre>
<p>But that will load the ParentProduct product, and not your ChildrenProducts collection, even though its just a list of <em>Product</em>.</p>
<p>What you want to do is:</p>
<pre class="brush: csharp;">

DataRepository.ProductProvider.DeepLoad(product,true,DeepLoadType.IncludeChildren, new []{typeof(TList&lt;Product&gt;)});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2009/12/deeploading-with-nettiers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OnItemCommand for Nettiers 2.3</title>
		<link>http://www.unauthorised-access.com/2009/04/onitemcommand-for-nettiers-23/</link>
		<comments>http://www.unauthorised-access.com/2009/04/onitemcommand-for-nettiers-23/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:12:55 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[NetTiers]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[patch]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=184</guid>
		<description><![CDATA[Well the good news is I have submitted my patch to include the OnItemCommand for the TableRepeater in Nettiers 2.3 &#8211; You can either download the file from this link, or directly from here (it lives in WebLibrary\UI)]]></description>
			<content:encoded><![CDATA[<p>Well the good news is I have submitted my patch to include the OnItemCommand for the TableRepeater in Nettiers 2.3 &#8211; You can either download the file from <a href="http://code.google.com/p/nettiers/issues/detail?id=196">this link</a>, or directly from <a href="http://www.unauthorised-access.com/wp-content/uploads/2009/04/tablerepeater.cst">here</a> (it lives in WebLibrary\UI)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2009/04/onitemcommand-for-nettiers-23/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Extending Nettiers Part 2 &#8211; Adding an OnItemCommand</title>
		<link>http://www.unauthorised-access.com/2008/11/extending-nettiers-part-2/</link>
		<comments>http://www.unauthorised-access.com/2008/11/extending-nettiers-part-2/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 19:10:20 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[NetTiers]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[w00tles]]></category>
		<category><![CDATA[WebControls]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=57</guid>
		<description><![CDATA[A few days ago, I decided to try to extend the Repeater Control, by adding an OnItemCommand, like the System.Web.UI.WebControl. Simple I thought. Shouldnt be that hard I thought. I couldnt have been more wrong. I have learned alot with the whole experience. I have learned about event bubbling, the way that events get passed [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, I decided to try to extend the Repeater Control, by adding an OnItemCommand, like the System.Web.UI.WebControl. Simple I thought. Shouldnt be that hard I thought.</p>
<p>I couldnt have been more wrong.</p>
<p>I have learned alot with the whole experience. I have learned about event bubbling, the way that events get passed up the control tree till they are handled by their parents. Iv learned about the way that items that are nested will need to be databound for the event to be fired, even if the data is being shown on the page, you still have to explicitly call DataBind(); And I got some help from a random guy (who works for telerik!) on StackOverflow, thanks!</p>
<p>Basically, this is the way it works. When a user hits a button (Like a &lt;asp:button) on the page, it will bubble up (OnBubbleEvent) on the ITemplate (In this case, the actual type of the ItemRepeater). That will do its magic, work out if its a CommandEventArgs, if it is, then bubble it up:</p>
<pre class="brush: csharp;">

protected override bool OnBubbleEvent(object source, EventArgs e)
{
if (e is CommandEventArgs)
{
RepeaterCommandEventArgs args = new RepeaterCommandEventArgs(this, source, (CommandEventArgs) e);
base.RaiseBubbleEvent(this, args);
return true;
}
return false;
}
</pre>
<p>Taken from System.Web.UI.WebControls.RepeaterItem.OnBubbleEvent(object source, EventArgs e);</p>
<p>From there, the Repeater will intercept that, then process it:</p>
<pre class="brush: csharp;">
private static readonly object EventItemCommand = new object();

protected override bool OnBubbleEvent(object sender, EventArgs e)
{
bool flag = false;
if (e is RepeaterCommandEventArgs)
{
this.OnItemCommand((RepeaterCommandEventArgs)e);
flag = true;
}
return flag;
}

protected virtual void OnItemCommand(RepeaterCommandEventArgs e)
{
RepeaterCommandEventHandler handler = (RepeaterCommandEventHandler)base.Events[EventItemCommand];
if (handler != null)
{
handler(this, e);
}
}

public event RepeaterCommandEventHandler ItemCommand
{
add
{
base.Events.AddHandler(EventItemCommand, value);
}
remove
{
base.Events.RemoveHandler(EventItemCommand, value);
}
}
</pre>
<p>This is where the fun starts. First off, in the RepeaterItem source code, you cannot call:</p>
<pre class="brush: csharp;">
RepeaterCommandEventArgs args = new RepeaterCommandEventArgs(&lt;strong&gt;this&lt;/strong&gt;, source, (CommandEventArgs) e);
base.RaiseBubbleEvent(this, args);
</pre>
<p>because <strong>this</strong> refers to a RepeaterItem, which, in my case, it is not because its a Nettiers generated RepeaterItem. So you have to go off and create your own CommandEventArgs. If you create your own EventArgs, the event handler <strong>RepeaterCommandEventHandler </strong>wont work, because its not of the type <strong>RepeaterCommandEventArgs</strong>. Which is a pain in the arse!</p>
<p>Once you have created the EventArgs and the event handler though, its fairly simple from there &#8211; you just modify the Reflector&#8217;ed code (From the RepeaterControl), to get it to handle your custom Repeater Item&#8217;s event, and not the RepeateItem default event which you cant even call!</p>
<p>But your not done! I found out that the command wont get called when someone clicky&#8217;s on it, because you havnt called DataBind(); on the control, which explains some &#8230; oddities I spotted in the code when I was digging around inside the Repeater &#8211; I kept finding calls to &#8220;EnsureDataBound()&#8221; &#8211; which is called OnPreRender:</p>
<p><img class="alignnone size-full wp-image-58" title="windowclipping-75" src="http://www.unauthorised-access.com/wp-content/uploads/2008/11/windowclipping-75.png" alt="" width="445" height="73" /></p>
<p>Note: I will provide code samples and Nettiers templates very soon, as soon as I have integrated my changes into Nettiers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2008/11/extending-nettiers-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
